rigidbody.moveposition local coordinates?

I am making a character controller that must be affected by physics.

I have experimented with AddRelativeForce and its modes, but found that moveposition has more of the properties I need.

Except for one thing. It only seems to work in world space. This means that no matter which way I turn, pressing the forward arrow always makes me move north.

I am having a lot of trouble finding a workaround.

Here is what I have so far

function FixedUpdate () {

var up=Input.GetAxis("Vertical");
var side=Input.GetAxis("Horizontal");   
var speed : Vector3 = Vector3 (3*side, 0, 3*up);

rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime);
}

I think you need to alter the speed vector3 by a quaternion of the angle you are facing. I had a similar problem, and I’ll attempt to translate what I did to your situation:

var direction : Quaternion = Quaternion.Euler(0,transform.eulerAngles.y,0);
speed = direction * speed;
rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime);

I don’t know javascript (my project was in c#), so my variable declaration for the quaternion may be incorrect. The quaternion should alter your Vector3 to match the direction you are facing (transform.rotation.y).