EDIT:
Okay, found what I was looking for. Needed to use AddForce (who woulda figured?).
++++++++++++++++++++++++++++++++++++++++++++++++++
I realize it’s a simple thing, but I’ve been trying to figure out how to make my character move forward as if a rocket booster were kicked in when the w key is pressed, but I’m still a floundering newbie when it comes to coding. I’ve looked at a lot of scripts that ‘kind of’ deal with rockets/boosters/etc, but I guess it’s just not sticking.
Code so far:
var thrustForce : int = 20;
var thrustClip : AudioClip;
function Update () {
if (Input.GetButton ("Thrust")) {
velocity = transform.TransformDirection(Vector3(0, 0, thrustForce));
//audio.PlayOneShot(thrustClip);
print("w pushed");
}
}
I get the notification that the w key is pressed, so I have the axes set up right, but I’m not getting the force.
Any wonderful people out there with pointers in the right direction?
Many thanks,
Hermit