Camera and Physics controls for sledding-styled game

I am very new to Unity, but I have a background of using dim3 engine a bunch. I have been trying to make a camera script that I could use on a sled character. My goal is to have the camera's POV be that of a person riding the sled (so it would see the tip of the sled and still be glued to the sled model), but I don't know how to set this up. I also would like to know how to make an acceleration type of movement where after I start pressing a forward button, the character (sled) continually increases in speed until, for example, I press another key to "apply brakes" (i.e. slow it down again). Could anyone be so kind as to help me set this up? I think once I get this camera script down the rest would be a bit easier (already tried making tracks/ colliders.)

To make a camera seem "glued" to an object, the simplest way is to parent the camera to the object, by dragging it on to the object in the hierarchy. This way, whenever the parent object is moved (the sled), the camera will also be moved.

To allow keyboard controls to affect the movement of the sled, you need to ensure the sled gameobject has a collider and a rigidbody component attached. You probably should then apply the "Ice" Physic Material to both the sled and the terrain or ground object. This will allow the sledge slide easily down slopes.

Usually when writing games using the physics engine, you'd want to add forces to the player object using AddForce in your FixedUpdate function, however in your specific case it might be enough to simply modify the drag of your rigidbody. If you're on a hill, and you've applied the Ice physic material to the objects, then setting "drag" to zero would be like allowing acceleration, and setting "drag" to a higher value would be like braking.

You could implement this using a script something like this:

var originalDrag : float;

function Start() {
    originalDrag = rigidbody.drag;
}

function FixedUpdate () {
    var control = Math.InverseLerp(1, -1, Input.GetAxis("Vertical"));
    rigidbody.drag = Mathf.Lerp(0, originalDrag*2, control);
}

The script above uses the vertical axis input (your forward and backwards arrow keys), and adjusts the drag based on that input.

When pressing forward, there will be zero drag, and when pressing backwards there will be double the value of drag specified in the editor. When not pressing anything, the editor value is used. This means you can tweak the "drag" value in the editor until your sledge runs at an acceptable speed, while still being able to control it via your script.

Hope this is something near what you're looking for!

Ok, I think I get it, but I'm getting confused by your script example and the "Ice Physic material". I found the physic material, but I am assuming by calling it "Ice" you just intend for me to call it "Ice" and change settings of friction accordingly.

In the drag script you posted above, is that supposed to be placed in a script like the FPSWalker, or by itself?

Here is a picture of what I got so far following your explanation and my own variation... hope it is decently correct. :)

http://img97.imageshack.us/img97/1296/screenshot20100220at348.png