summaryrefslogtreecommitdiffhomepage
path: root/Racing-Game/4WheelCar/Wheels/Wheel.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Racing-Game/4WheelCar/Wheels/Wheel.gd')
-rw-r--r--Racing-Game/4WheelCar/Wheels/Wheel.gd5
1 files changed, 3 insertions, 2 deletions
diff --git a/Racing-Game/4WheelCar/Wheels/Wheel.gd b/Racing-Game/4WheelCar/Wheels/Wheel.gd
index d25cec5..ab00de6 100644
--- a/Racing-Game/4WheelCar/Wheels/Wheel.gd
+++ b/Racing-Game/4WheelCar/Wheels/Wheel.gd
@@ -4,7 +4,8 @@ var velocity #How fast car is moving
var velVector #What direction the car is moving
var velUnitVector #Direction vector, but in a single unit(no magnitude)
var velAngle #The angle of the velocity(relative to world)
-var carAngle #The angle to car is facing(relative to world)
+var carAngle #The angle the car is facing(relative to world)
+var wheelAngle #the angle the wheel is facing(relative to world)
var nullStrength #sums up all sources of null to here
var isSkid = false #this one is used when user presses shift. Initially called in this function
@@ -41,7 +42,7 @@ func null_slide(var strength, var delta):
#strength is how strong you would like the nullify to be
#higher is less sliding/drifting
var movementUnitVector = get_linear_velocity().normalized()#the direction of the velocity
- var directionAngle = carAngle + (PI/2.0)#the angle the car is facing(relative to the world)
+ var directionAngle = wheelAngle + (PI/2.0)#the angle the car is facing(relative to the world)
var directionUnitVector = Vector2(cos(directionAngle),sin(directionAngle)).normalized()#the direction the car is facing
var nullify = directionUnitVector * movementUnitVector.dot(directionUnitVector)
wheelSlip = (-(movementUnitVector - nullify))*strength