I'm having trouble moving a basic rigid body object. Simple I know. But I just can't seem to get it to work. All I want to do is move it by a basic 3D vector. Does anyone have any tips how I can do it? I'm rather new to unity.
You can use
Where offset is the vector direction you want to move in
answered Jul 04 '10 at 11:04 AM
There are multiple ways to move objects. Through rigidbody force (the physics system, through Linear Interpolation (Lerp for short), and also through the transform (which I believe uses Matrices Transforming, but I'm not a math guru).
I've written a detailed guide on how to move through rigidbody forces on my studio's website http://wiki.certainlogicstudios.com/
There is also the CharacterController class, which uses one of the above listed methods. I'm not sure which one. The class itself has something of a bad reputation. I think it is expensive to use, and is only meant to be used on 1 character in your game at a time, like the main player in a platformer (but not the enemies).
iTween does take a lot of the mystery out of movement (unless you wonder how they are performing their black magic, then it's even more mysterious!). I don't have a lot of experience with it, so someone please correct me if I am wrong, but I don't believe you can use the physics system with it.
So, it really depends on the kind of game you are making, and how you want your objects to react.
Edit: Make sure you do your physics updates inside of FixedUpdate, which fires at a constant interval. Update fires once per frame, and is therefore dependent on the frames per second of the computer running the game. You may experience poor physics simulations because of that.
answered Aug 27 '10 at 04:18 AM