- Home /
Question by
JeanModeler357 · Feb 25, 2012 at 10:09 AM ·
3dshoot
What is wrong with this?
var bullitPrefab : Transform;
var force : int;
function Update () {
if(Input.GetButton("Fire1"))
{
var bullit = Instantiate(bullitPrefab, GameObject.Find("spawnPoint").transform.position, Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * force);
}
}
My bullet just go to the left! WHATS WRONG????
Comment
Answer by FLASHDENMARK · Feb 25, 2012 at 10:14 AM
There is nothing wrong with it, it is doing excatly what you are telling it to do. The reason being is properly that your charcters face is not facing in the local Z direction. To solve it you can try to use transform.right or -transform.right(notice the minus).
Thank You so much!!!! It working now! Thank you again!!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Newb friendly error x.x conversion float to int 3 Answers
A node in a childnode? 1 Answer
Guard pass throught the walls in Unity Project #1 Stealth! 1 Answer
Light flashing through walls help 0 Answers