【发布时间】:2018-05-17 01:23:11
【问题描述】:
我希望以 30˚ 的角度和 30 m/s 的速度发射我的 箭头 GameObject。在一个脚本中,我为这个箭头添加了一个刚体。但是,我也尝试在 3D 场景 中向玩家的方向(远离敌人)发射此箭头。我不知道如何插入这些变量以获取“arrowRigidbody.velocity”的 Vector3
//THE VARIABLES REFERENCED ABOVE APPEAR LIKE SO:
Rigidbody arrowRigidbody;
Transform playerTransform;
Transform enemyTransform;
float angle = 30f;
float velocity = 30f;
//How do I use these variables in order to shoot the projectile at a speed
//of 30 m/s and an angle of 30˚ in the direction of the player in 3D scene
arrowRigidbody.velocity = /*????*/;
感谢您的时间和耐心:)
【问题讨论】:
标签: c# unity3d game-physics rigid-bodies