is there any way I can add a continuous forward movement to a third person character? The game is a snowboard game so I only want it to move / rotate left and right. I have tried using a ridged body instead but am having uber problems getting it to work how I want
You can try with a simple animation-driven character controller like the one released for Unity by Mixamo. It is powered by a RootMotionComputer script, created by Adam Mechtley. It allows the controller to use actual animation curves to drive the motion of the root of the character, instead of using a procedural approach which would lead in general to a worse quality and motion artifacts like foot slide. On top of that you can add a constant Z-foward speed on the parent game object on the Update() function. Done. Hope this helps!
You can download the project file, as well as see video tutorials about its use here:
Here's something I had tried out sometime back for something similar..
public float movingRate = 0.1f; //rate of movement
private float mLeftRightInput; //Left-Right input
private bool mDoLeftRightMove = false; //is moving Left or Right
private bool mDoStartMoving = false; //has simulation started
private Vector3 mDelta; // the movement delta every fixed update
In your Update() function check for left-right input.. (am assuming you are checking for Left-Right arrow keys only for now.. hence only checking the "Horizontal" axis)
Then in your FixedUpdate(), make the character move accordingly..
void FixedUpdate()
{
if (mDoStartMoving)//if simulation has started..
{
if (mDoLeftRightMove)
{
mDelta = transform.right * movingRate * mLeftRightInput;
mDoLeftRightMove = false;
rigidbody.MovePosition(rigidbody.position + mDelta);
EaseRotation(Quaternion.LookRotation(mDelta)); // this is simply Lerping the rotation in the direction of mDelta
}
else
{
mDelta = transform.forward * movingRate; //this will keep it moving in the forward direction
rigidbody.MovePosition(rigidbody.position + mDelta);
EaseRotation(Quaternion.LookRotation(mDelta)); // this is simply Lerping the rotation in the direction of mDelta
}
}
}
This still uses a rigidbody, but that's just because my thing was a physics simulation.. and its just easy that way!
Hope this helps!