Slow down over high ground

Apprentice
Posts: 16
Joined: 2008.01
Post: #1
I have some simple 2D physics for my sprites moving over a flat surface which works adequately. I have now put a variable height landscape and everything seems to work ok except the sprites speed over the surface. Obviously (now that I come to think about it) 2D speeds over a 3D landscape is way too simplistic: the sprites appear to rise over the landscape at mach 1. Is there a simple way to put more realistic behavior without huge effort. (If the gradient is too steep then I guess that direction should be a block going up or a fall going down).

The sprites have x,y coordinates and z which reflects the height for each floor panel...
Quote this message in a reply
Member
Posts: 59
Joined: 2007.12
Post: #2
I hope I understood your problem correctly.
You could calculate the angle of the slope you're on (with atan(ydiff/xdiff) or similar). You can then multiply your 2d velocities by cos(angle) to get the effective velocities.
Quote this message in a reply
Apprentice
Posts: 16
Joined: 2008.01
Post: #3
Thanks _ibd_ that would be it. Thanks!
Quote this message in a reply
Post Reply