Realistic Car Controls
Ok, I've been struggling with this for quite some time. I'm hardly a novice when it comes to Gamesalad, but for the life of me I can't work out how to get a car to function how I want it to.
Basically, its a top down racing game with collidable obstacles. I need the player to be able to move in any direction through acceleration/braking/drag. It also must have a speedo. Now the problems are as follows.
====================================
For the most realistic driving mechanics, I've tried this:
If Gas is true;
--> Timer - Every X increase "Speed" to "Speed+1"
Move at speed of attribute "Speed"
Rotate left/right with pedal presses.
Decelerate similarly if no button is pressed to simulate drag by lowering the speed attribute.
Despite having perfect steering, the problem with this setup is that collisions are just awful, and the car doesn't bounce accordingly when it hits an obstacle.
Furthermore, I need a speedo (I've tried both displaying the 'Speed' attribute and the equation '√linearvelocity.x^2+y^2'), which in this setup doesn't faithfully represent the players motion when they are accelerating against a wall.
====================================
I've also tried a setup as follows:
If Gas is true;
--> Accelerate in direction of 0, at rate of X.
Rotate left/right with pedal presses.
Use local attributes such as drag to provide realistic physics.
This system provides the perfect collision & drag physics, as well as a functioning and correct speedo reading, but very loose steering.
====================================
These represent the barebones of the mechanics I'm trying. I've also played around with countless variations including using 'Change Velocity' etc, but to no avail.
So I give up! XD Someone help me please!
Comments
DBA has a couple of popular car racing templates if that helps.
Darren.
Cheers Darren, but I've already built my original game off the back of your GS Racerz template! (Which is by the way fantastic, especially for the opponent AI!)
Its just that this template doesn't really provide a feasible way of measuring speed, especially when the player is driving into an obstacle, and I also had problems with the collisions.
Bump because this issue is the only thing delaying my game from being published
@iCreationZ For the car speed have you tried constraining a game.CarSpeed (Integer) to magnitude( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y ) in the car actor, i used this method in my Stickman Golf template to determine if the ball was going slow enough to go in the hole and it worked well.
Darren.
While that provides a useful speedometer, it doesn't fix the biggest issue that if a player is accelerating against a wall, the speedo keeps climbing until it maxes out;- even though they are physically and visibly stationary. I need a way of monitoring the actual speed the car is moving at, which no method I've found or tried is achieving. But thanks for the help thus far Darren!