- Home /
bullets are spawning under me and they don't move
my bullets are spawning under my first person controller and the dont move ,
could someone help me ????
this is my script
var projectile : Transform; var bulletSpeed : float = 20;
function Update () { // Put this in your update function if (Input.GetButtonDown("Fire1")) {
// Instantiate the projectile at the position and rotation of this transform
var clone : Transform;
clone = Instantiate(projectile, transform.position, transform.rotation);
// Add force to the cloned object in the object's forward direction
clone.rigidbody.AddForce(clone.transform.forward * shootForce);
}
}
Answer by Owen-Reynolds · Feb 20, 2013 at 02:50 PM
It completely stays in the eact same spot? Does your bullet have a rigid body? (if not, you should also be seeing "can't set speed" errors.)
The second G*gle search entry for "Unity fire bullet" has an example of using an empty to say where bullet should come from, instead of under your feet: http://answers.unity3d.com/questions/33507/trouble-with-script-to-fire-a-bullet-from-a-handgu.html.
Unsurprisingly, there are many, many other old, answered, questions about every aspect of shooting bullets.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
AddComponent adds too many (C#) 3 Answers
sending message to bullet (javascript) 1 Answer
How do I make the gun stop shooting when I am out of ammo? 1 Answer
Rapid fire Help 1 Answer