Page 1 of 1

Car Game. How to change angle of car to follow slope?

PostPosted: Thu 15 Jun 2017, 04:46
by ThePaperComet
I would like to create a car racing game where the car always faces to the right (so you see a side on view) and moves over land/platforms. What I can not seem to figure out is the movement combination. I can create the character as a platform char so it can jump and move etc, however the char is always horizontal and does not change angle with the slope of the platforms. I have tried changing the collision points on both the char and the platform. I have added physics but that doesn't seem to do it. I am sure the answer is simple but it is alluding me :? :? :? Any ideas how I could do this?

Re: Car Game. How to change angle of car to follow slope?

PostPosted: Fri 16 Jun 2017, 06:21
by DeeStudio
I tried to make a clone of hill climb racing last year(never completed it) but face the same problem amd failed to do so ......so i will also like to know how to do it :D

Re: Car Game. How to change angle of car to follow slope?

PostPosted: Sat 17 Jun 2017, 21:40
by MattLB
Not tested, but you could maybe create an invisible "bumper" object that you position at a point right at the front of the car to detect the slope. If this bumper object is in collision with the ground object then you apply an anti-clockwise rotation to the car object. You will have to shift the centre of the car object to near the back wheel so that the rotation doesn't push the back end into the ground.

This will only work going up a slope, so you'll need another invisible object positioned below the front of the car to rotate it clockwise when it *isn't* in collision with the ground object so that it faces down slopes.

Re: Car Game. How to change angle of car to follow slope?

PostPosted: Sun 18 Jun 2017, 08:06
by ThePaperComet
Ooo thats another way to do it. I was trying something similar today by making a dozen different slopes out of a bar and using a block to match the slope :) Still a little jerky in the movement but it has possibilities.

Re: Car Game. How to change angle of car to follow slope?

PostPosted: Sun 18 Jun 2017, 17:00
by Lizard-13
For a car game I would use pure physics, platformer behavior has fixed angles and is not "real" physics at all, so you end trying to simulate physics bahaviors when you have this already out of the box in another extension :)

There was a post some years ago from victor with a nice car example, I can't find it so I made a new one:
(40.39 KiB) Downloaded 66 times

Re: Car Game. How to change angle of car to follow slope?

PostPosted: Tue 20 Jun 2017, 12:36
by ThePaperComet
Thanks :*