Ridiculously easy question: Moving an object

 0 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. ``````function Update () { var acceleration = iPhoneInput.acceleration; var offset : Vector3 = Vector3(acceleration.y,acceleration.x,0); rigidbody.MovePosition(rigidbody.position + offset); } `````` more ▼ asked Jul 04 '10 at 11:01 AM ROM 277 ● 46 ● 49 ● 58 Cyclops 7.1k ● 33 ● 63 ● 115 @Strange - what are some of the other properties of the Rigidbody? Mass, gravity, etc? You can re-edit your Answer to update it. Jul 04 '10 at 01:33 PM Cyclops add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 You can use ``````rigidbody.MovePosition(rigidbody.position + offset); `````` Where offset is the vector direction you want to move in more ▼ answered Jul 04 '10 at 11:04 AM Mike 3 30.6k ● 10 ● 67 ● 254 Yeh see this is the kinda thing i've been trying but something isn't working. Heres the code i'm using currently:function Update () { var acceleration = iPhoneInput.acceleration; var offset : Vector3 = Vector3(acceleration.y,acceleration.x,0); rigidbody.MovePosition(rigidbody.position + offset); }I'm using the iPhone as a remote and the acceleration seems to have no real baring on the way the object moves. I'm sure i'm doing something wrong.... Jul 04 '10 at 11:40 AM ROM @Strange, you should generally put code back into your original Question, and you can format it with the "1010101" button. Fixed. (But at least you used the comment field, and didn't create a whole new Answer like people sometimes do. :) Jul 04 '10 at 01:31 PM Cyclops In that case, i would have thought adding a force would be more appropriate Jul 04 '10 at 02:20 PM Mike 3 Yeah, if you're using RigidBody, you ought to use AddForce() or AddRelativeForce() when moving them anyway. Moving the transform leads to the dark side. Jul 04 '10 at 03:22 PM Novodantis 1 I thought it would be rigidbody.position * offset if rigidbody.position is a Vector3 Jul 04 '10 at 07:44 PM fireDude67 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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. more ▼ answered Aug 27 '10 at 04:18 AM tylo 297 ● 5 ● 9 ● 18 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 Check out iTween, its an epic animation script for unity, beats the hell out of the default unity animator. there is documentation and video tutorials on the site: http://itween.pixelplacement.com/ hope this helps more ▼ answered Jul 04 '10 at 11:35 AM Jason Hamilton 445 ● 68 ● 73 ● 80 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email: