help with global and local

Hi, I am trying to write a script for moving the main character in the direction the main camera is looking by draging the mouse, so I use the defsault mouse look script for the camera, and the next script in the terrain

var me : GameObject;
function OnMouseDrag () {
var fwd = transform.forward * 50;
me.rigidbody.AddForce(fwd);
}

So, te var “me” correspond to the main character, but although I use “forward” in order to move it on local position, it always move on global.
Any suggestions?

That code will move the object along its own z axis (the ‘blue arrow’ when you view the local coordinate system of the object in the scene view).

If that isn’t what you want, you may need to define more clearly what you mean by ‘local’ and ‘global’. If you want the object to move in the direction the camera is looking, you could substitute the camera object’s forward vector for the ‘me’ object’s forward vector. (You might have to make some further adjustments though, depending on what the environment is like and how the camera is oriented.)