Jump to content
  • Advertisement
Timothy Sharp

Idea for game

This topic is 454 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

8 minutes ago, MarcusAseth said:

I've never used Unity before, only Unreal :P


Also, Marcus I have a problem. I got a car WASD turn script, but its all wobbly and all the keys are messed up. I hope your good with java



//inspector variables

var speed:float=5; //speed of the car, tweek as needed based on your scale
var turnSpeed:float=180; //turn speed

function Update() {
    //grab the input axes
    var steer=Input.GetAxis("Horizontal");
    var gas=Input.GetAxis("Vertical");

 //if they're hittin' the gas...
 if (gas!=0)
     //take the throttle level (with keyboard, generally +1 if up, -1 if down)
     //  and multiply by speed and the timestep to get the distance moved this frame
     var moveDist=gas*speed*Time.deltaTime;
     //now the turn amount, similar drill, just turnSpeed instead of speed
     //   we multiply in gas as well, which properly reverses the steering when going 
     //   backwards, and scales the turn amount with the speed
     var turnAngle=steer * turnSpeed * Time.deltaTime * gas;
     //now apply 'em, starting with the turn
     //and now move forward by moveVect


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!