How do I set rag doll back to default animation pose?

Get help using Construct 2

Post » Mon Sep 14, 2015 3:14 am

Asked this earlier, either got deleted, or I didn't click submit? am I that MR?

How can I get my rag doll to shift back to his default position gradually, like a comfort zone? NOT snap back, and I can't use set rotation towards angle because his position will be different.
That make any sense?
B
10
S
4
G
3
Posts: 223
Reputation: 3,458

Post » Tue Sep 15, 2015 12:44 am

How are you doing the ragdoll, as in how is it setup? Any answer depends on that.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Mon Sep 21, 2015 3:44 am

Just with limited revolution joints. How else would I do it?
B
10
S
4
G
3
Posts: 223
Reputation: 3,458

Post » Mon Sep 21, 2015 5:11 pm

Ok cool.
The simplest idea would be to save the initial angles and positions of each part of the ragdoll and rotate and move each piece toward those initials when you want it to reset. You may even be able to get away with only using the initial angle. Here's the idea. You can replace the "every tick" with a condition to reset the ragdoll.

Start of layout:
--- sprite: set initialAngle to self.angle

Every tick:
--- sprite: rotate 100*dt degrees toward self.initialAngle


A slightly more deluxe idea would be to save the initial angle difference between each body part and the other part it's connected to. It would probably give a more natural motion I imagine.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971


Return to How do I....?

Who is online

Users browsing this forum: Cub3D, David181, yiuyiu6666 and 27 guests