- Home /
Question by
vladdrummer · May 03, 2014 at 11:51 AM ·
rigidbodyvector3jump
how do I push object forward into direction it is facing?
Actually I want character to jump to direction he is facing, so how do I push it a little bit into direction he is facing right now?
Comment
Answer by Socke97 · May 03, 2014 at 12:19 PM
Maybe you can use:
if(Input.GetKey(KeyCode.Space))
{
rigidbody.AddForce(0, 0, pushForce);
}
Answer by roponator · May 04, 2014 at 10:55 PM
if(Input.GetKey(KeyCode.Space))
{
rigidbody.AddForce(transform.forward); // you may need so set x,y,z seperate if no Vector3 overload, also assuming you object is properly oriented, other try transform.right or transform.up
}