- Home /
Question by
Firedan1176 · Mar 22, 2014 at 01:49 PM ·
vector3addforcenormalized
AddForce with direction not working??
I'm using this:
Vector3 addforceDirection = hitObject.transform.position - Camera.main.transform.position;
addforceDirection.normalized;
hitObject.transform.rigidbody.AddRelativeForce (addforceDirection * blowback);
And the hitObject.transform.position that I'm hitting isn't getting blown in the direction I want it to. It's always just backards. No matter what I change he just flies backwards. I've tried AddForce and AddRelativeForce. What did I do wrong?
Comment
Best Answer
Answer by robertbu · Mar 22, 2014 at 02:16 PM
You are generating a world direction, but you are using a function that takes a local direction. Change 'AddRelativeForce()' to 'AddForce()'.
Answer by Firedan1176 · Mar 23, 2014 at 12:33 AM
Ok nevermind, this wasn't the issue it's just the animations my model has ends up making him clip inside himself. I just need more force added. Thanks anyways! Making it AddForce did help it