- Home /
Rigidbody version of transform.forward
Hey guys, I am writing in Javascript with Unity. When developing my game, I ran into a problem. I use transform.forward to move my character in the direction he's pointing, which works great... Except for that now that I am using transform, my OnCollisionEnter's work all funky.
So is there any way I could get the same effect of transform.forward without transform?
Answer by Cherno · Sep 07, 2014 at 10:55 PM
There are several possibilities:
Use AddForce as described above (I don't like it for movement because while it behaves realistically, it doesn't "feel right" since the character will not come to a stop immediately, as is expectied in most games)
Transform.translate (with Space set to World) (Works great)
Set the rigidbody's veclocity directly.
I recommend thus tutorial for learning rigidbody movement, inclduing jumping and animation: Unity 3.x Scripting-Character Controller versus Rigidbody
Answer by flaviusxvii · Sep 07, 2014 at 02:25 PM
Sorry, I don't think you understand. I am trying to create a script that doesn't use any transform.anything. In fact, I directly said in my post no transform.forward. Could you please read it the whole way through before answering?
Your answer
Follow this Question
Related Questions
How can I make the nearest astroid move to my preset location? 0 Answers
A node in a childnode? 1 Answer
How to add to a 3D object's length through code? 1 Answer
How to open Unity 3D on a Macbook 1 Answer
Adding Videos In Unity (URGENT) 1 Answer