Physics for car movement?

For questions about using Classic.

Post » Mon Nov 26, 2007 6:24 am

Hi everyone, I'm trying to create a slightly more realistic car movement engine by using the physics engine instead.
I reckon I would have it all figured if i knew how to make the physics engine apply velocity to something in the direction that it's facing. That way (hopefully) the physics engine would more accurately handle crashes, rather than making the car go the opposite direction etc.

Anyway I'm assuming it's got something to do with math and trigonometry since velocity seems to be X and Y based rather than directional, but I've COMPLETELY forgotten all that stuff, if anyone could help out it would be great thanks :)
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Mon Nov 26, 2007 9:06 am

Wait I think I got it now:
set x velocity to x velocity + cos(sprite.angle)
set y velocity to y velocity + sin(sprite.angle)

i have NO IDEA of the maths behind it but it seems to work fine yay! I just knew it had something to do with sin and cos so I randomly tried things till i got it haha
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Mon Nov 26, 2007 6:57 pm

Ashley (Tigerworks) wrote a nice car movement tutorial on the clickteam knowledge base, obviously that was for MMF so wouldn't work directly, but he explain all the maths behind it and you could of probably reproduced it in contruct woth out too much effort.

The knowledge based seems to have been abandoned though and most of the pages don't work any more.
B
37
S
19
G
18
Posts: 616
Reputation: 10,237

Post » Sat Apr 20, 2013 5:49 am

.cap ?
B
5
Posts: 6
Reputation: 518

Post » Sat Apr 20, 2013 5:49 am

http://www.scirra.com/FORUM/topic66653_post409342.html#409342
B
5
Posts: 6
Reputation: 518


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests