- Home /
Move Agent with gravity, let him fall into a hole
Hi
iam trying to move an gravity bound agent/charackter automatically along one axis. if he try to pass a gap/hole i want to make him fall down. but at the moment he is not falling - its more a slow walk into the "deep" - do you have some suggestion or better solutions? hope someone can help me, thank you
here is my code:
var speed : float;
var gravity : float = 9.8;
function Update ()
{
GetComponent(CharacterController).SimpleMove(Vector3.zero);
transform.Translate(Vector3(0,0,speed) * Time.deltaTime);
}
function FixedUpdate()
{
rigidbody.AddForce(Vector3 (0, -gravity*rigidbody.mass, 0));
}
Hey bud, try removing the $$anonymous$$us "-" at the start of your arguement for the y axis in your "AddForce()" method call.
so it reads like this....
rigidbody.AddForce(Vector3 (0, gravity*rigidbody.mass, 0));
what happens then ? Take care bud. Gruffy
hey gruffy thx for your fast response... hmm i removed it, but nothing happens.
Your answer
Follow this Question
Related Questions
Can't move when fall from high 1 Answer
CharacterController.Move() and zero values. 0 Answers
Mark on the ground for falling object in Unity3D 2 Answers
Can someone help me with this Rigidbody2D bug? 1 Answer
PROBLEM need Fix! 0 Answers