Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

3D FPS Projectile

$
0
0
I've created a FPS scene. Player MainCamera Bow ShotPos That's the parent hierarchy of the current setup I'm using. This is the current script: public class FireArrow : MonoBehaviour { public Rigidbody projectile; public Transform shotPos; void Update () { if (Input.GetMouseButtonUp(0)) { Rigidbody shot = Instantiate (projectile, shotPos.position, shotPos.rotation) as Rigidbody; shot.AddForce (shotPos.forward * 100f); } } } It's spawning an arrow but the arrow stops moving forward after about 1 second and falls to the ground. Can anyone help? EDIT: I've updated the script and now the arrow is jumping out to the left rather than moving forward? The movement has gotten better however it's still not right.

Viewing all articles
Browse latest Browse all 1264

Trending Articles