# I am looking for explanation on: Rigidbody character movement

I have looked at multiple scripts involving Rigidbody character movement, I can’t make sense of them as they don’t have key binding or values, yet they move and work as they should.

all I ask for is someone to guide me (a complete newbie) through creating a rigidbody movement script from scratch, and how it works.

Thank you to all who respond.

A rigidbody is basically physics. That’s all. So a rigidbody character is one affected by physics. If another rigidbody with more mass crashes into it, it’ll push it. Gravity will affect it. In order to make a rigidbody character you need to add a collider to it, otherwise it’ll just fall through the floor. Of course there are exceptions, such as making gravity = 0 or directly assigning the rigidbody’s velocity.y to = 0. That’s how a rigidbody character moves, by affecting it’s velocity. You can use addforce to add a force in a direction and push the rigidbody or you can assignthe velocity directly (although this won’t let physics get calculated correctly which should be the main reason you are using a rigidbody character).

This is a good starting point for rigidbody physics control:

Roll-A-Ball

Skip to the third video, “Moving the player” if you want to get to the heart of it.

‘Adding RIGIDBODY to a body’ is ‘Enabling the body to react to PHYSICS rules and values’…

for example… a rigidbody enabled body will react to gravity (can fall down)… it can

push another object (apply force to other object).

Basic movement script can be made without using rigidbody component too as i have shown below…

Suppose you have a rigidbody enabled object and there is a javascript rigid.js that is applied to this object. This script will keep increasing the velocity of the object in the z coordinate and the object will not fall down when there is no collider beneath it as the gravity is turned off…

function start(){

``````       rigidbody.useGravity = false;
``````

}

function Update(){

``````    var translation : float = Input.GetAxis ("Vertical");
var rotation : float = Input.GetAxis ("Horizontal");

// Make it move 1 meter per second instead of 1 meter per frame...
translation *= Time.deltaTime;
rotation *= Time.deltaTime;

// Move translation along the object's z-axis
transform.Translate (0, 0, translation);
// Rotate around our y-axis
transform.Rotate (0, rotation, 0);

rigidbody.velocity.z += Time.deltaTime;
``````

}

This will make the object move for you using mouse or keyboard, whatever you have set as your axes in the input…

Good luck!