Last active
December 17, 2015 11:09
-
-
Save moyashipan/5600216 to your computer and use it in GitHub Desktop.
script for "non-gravity racing game prototype"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public var forwardSpeed:Number; | |
public var steerAngle:Number; | |
public var rotationT:float = 0.25; | |
function FixedUpdate () { | |
var x:Number = Input.GetAxis("Horizontal"); | |
var y:Number = Input.GetAxis("Vertical"); | |
if (HitTestWithRoad()) { | |
} | |
this.rigidbody.velocity += y * transform.forward * forwardSpeed; | |
this.rigidbody.AddTorque(transform.up * x * steerAngle, ForceMode.Acceleration); | |
} | |
function OnCollisionEnter(collision:Collision) { | |
if (collision.gameObject.tag == 'roadWall') { | |
//var contact:ContactPoint = collision.contacts[0]; | |
//this.gameObject.transform.position += contact.normal * 0.2; | |
} | |
} | |
function HitTestWithRoad() { | |
/* See http://gist.github.com/1271157 */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment