Best way to move a physic dude ?

Discussion and feedback on Construct 2

Post » Sat Nov 14, 2015 10:46 am

Hey everyone ! I've a small question for you. Until now, my character was moving because I've added some values in the corresponding velocity (x or y, depending of the pressed touch). It works, and it's perfect to test my settings (shaders, dynamic light, physic behaviors...) but I'm pretty sure there is another way to make it move.

Knowing that I don't use Box2D but Chipmunk physic (behavior-chipmunk-physics_t110815), can I ask how do you move your own physic characters to make it as fluide and realistic as possible ? (Even if you use Box2D, i'm just curious about it, because all my previous results were not bad but still a little...robotic ? I don't have the word, hope you understand anyway).

Using velocity only is something. But I presume that there's some ways to do it with force or impulse, right ?
B
16
S
4
Posts: 86
Reputation: 1,525

Post » Sat Nov 14, 2015 12:02 pm

Chipmunk is a good choice - I posted a wip example of a physics platformer in that thread: https://dl.dropboxusercontent.com/u/523 ... pe_v2.capx

I'm setting velocity directly, which should usually be avoided in a physics engine, but because I'm raycasting to test if you're next to a wall or on a slope I can prevent any clipping issues.

The reliable way to accelerate your player is by applying force (impulses are for instant movements like explosions or jumping). It won't cause any clipping problems. You can give the player a speed limit with the set max speed action, then decelerate by either increasing grounded friction or applying a force opposite to player.chipmunk.angleOfMotion.

Lots of ways to do it, just play around. For raycasting (to get info about what the player is in contact with, or will be in the next frame) check out events 30-39 in my example.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Sat Nov 14, 2015 1:05 pm

Hey ! Thanks for your replying. I didn't have the time to study your prototype yet, I just tried it and it seems to be a great work. I'm sure I'll learn a lot about it ! Also, thanks for these informations, I'll take note. :)
B
16
S
4
Posts: 86
Reputation: 1,525


Return to Construct 2 General

Who is online

Users browsing this forum: Tokinsom and 5 guests