Essentially I've currently got an object which is on a planet (think mario galaxy). If I move the object then it rotates around the centre point of the planet. The problem I have got is in actually moving it. When I move it it moves along the standard axis so it pulls away from the planet like in part 2 of the below image. I want it so it moves along its own axis like part 3 of the below image. Basically i want it so it moves around the planet rather than moving out of it. Does anyone have any idea how to do this?
Heres my current code:
function Update () {
var xval : float = -iPhoneInput.acceleration.y;
var yval : float = iPhoneInput.acceleration.x + 0.1;
if(xval > 0.5){
xval = 0.5;
}
if(xval < -0.5){
xval = -0.5;
}
if(yval > 0.5){
yval = 0.5;
}
if(yval < -0.5){
yval = -0.5;
}
var offset : Vector3 = Vector3(xval / 8, yval / 8, 0);
rigidbody.MovePosition(rigidbody.position + offset);
}
