physics simulated body that still animates

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

physics simulated body that still animates

Post by tsturzl »

So I'm having trouble coming up with a solution to this. I'm making a game where you have to kill zombies by removing there head(via gun, blunt object,etc), you can also remove other limbs to disable the zombies. When ever you hit them in the body, they'll fall and ragdoll.

I'm able to create a ragdoll zombie, using Box2D/love.physics, and use collision callbacks to test for velocity changes in limb(once exceeding a certain force, joint to limb is broken).

Thing is I cannot figure out how I'm going to animate the body. Right now its a ragdolled body that is lying motionless on the ground but the joint breaking works. I was thinking suspend the body by the head in air, then set the body to sleep and move it, but then the body is just sliding along the ground.
monkyyy
Citizen
Posts: 52
Joined: Fri Mar 16, 2012 5:29 pm

Re: physics simulated body that still animates

Post by monkyyy »

im also looking to get ragdoll physics, i'd rather have a lib but i cant seem to find one

@op to animate the body your going to need some level of ai. if im forced to write my own i would think i would want some states, such as walking, standing fallen over, and write some basic code for each state: walking, some research in to how to play qwop will be needed; standing, probaly just need the feet to push inward and then torso and head trying to stay inbetween the x's of the feet; fallen, trying to get on their knees then pushing at the ground with hands and some magic with their feet so they dont fall over again
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: physics simulated body that still animates

Post by tsturzl »

See the thing was they were going to ragdoll whenever they took damage. The zombies would also lose a limb/bodypart whenever that part of the body was struck hard enough, this would then break the joint on the ragdoll. I later realized this would require bonestructures, which would then require bonestructure animation.

I'd hate to implement walking zombies with physics, talk about intense AI.. I'm thinking I'll have to write a simple bonestructure animation library(simple in terms of the subject..) and animate that without physics, then when the zombies takes damage and loses a limb the bonestructure will be updated and the limb will have continuous collsion detection.

Zombie head soccer ball? I say "heck yes".
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: physics simulated body that still animates

Post by tsturzl »

See the thing was they were going to ragdoll whenever they took damage. The zombies would also lose a limb/bodypart whenever that part of the body was struck hard enough, this would then break the joint on the ragdoll. I later realized this would require bonestructures, which would then require bonestructure animation.

I'd hate to implement walking zombies with physics, talk about intense AI.. I'm thinking I'll have to write a simple bonestructure animation library(simple in terms of the subject..) and animate that without physics, then when the zombies takes damage and loses a limb the bonestructure will be updated and the limb will have continuous collsion detection.

Zombie head soccer ball? I say "heck yes".
monkyyy
Citizen
Posts: 52
Joined: Fri Mar 16, 2012 5:29 pm

Re: physics simulated body that still animates

Post by monkyyy »

how are u avoiding needing ai if its possible to go ragdoll then go back to its animated state?

also if ur write ALL the animation data for ALL the the possible bone structures i dont think u'll be saving much time
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: physics simulated body that still animates

Post by tsturzl »

monkyyy wrote:how are u avoiding needing ai if its possible to go ragdoll then go back to its animated state?

also if ur write ALL the animation data for ALL the the possible bone structures i dont think u'll be saving much time
I really don't see what you mean by AI. It would simply be code logic. Don't emulate the body when in walking state, upon taking damage, emulate ragdoll for n duration. After that, return to walking state, and lift the body with pully joints to an upright position. This isn't AI, perhaps walking would require AI, but thats not what I'm talking about. The walking would not be implemented in Box2D, but rather it would be an animation pinned with a box2D sensory object to test for collisions so it can go into ragdoll state.

I wouldn't write the animation data, I'd probably make a tool to generate a JSON table for the bone-structure animation.

I really don't know what you're meaning by "ai".
monkyyy
Citizen
Posts: 52
Joined: Fri Mar 16, 2012 5:29 pm

Re: physics simulated body that still animates

Post by monkyyy »

i mean ai as artificial life-like-ness

w/ ur current solution it seems like it will look very unlifelike and very buggy in may cases; what if u barely hit a hand, wont the zombie stand there for a few seconds stuned as it slowly moves its hand back into its old position? or one is next to a drop and u shoot it hard enough it falls, wont it start falling then start floating mid fall rotating to a standing position, then start refalling?
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: physics simulated body that still animates

Post by tsturzl »

monkyyy wrote:i mean ai as artificial life-like-ness

w/ ur current solution it seems like it will look very unlifelike and very buggy in may cases; what if u barely hit a hand, wont the zombie stand there for a few seconds stuned as it slowly moves its hand back into its old position? or one is next to a drop and u shoot it hard enough it falls, wont it start falling then start floating mid fall rotating to a standing position, then start refalling?
#1, you're talking 2D. I'm not going to simulate a walking, falling, standing. It seems more reasonable to do as I explained. Also a lot more realistic. Do you know how many bugs will arise if you simulate actual walking?

2#, you hit them hard enough, or apply enough force over time they'll fall and ragdoll. Set joints to pull the zombie back up by its head, have an animation to raise the arms from its side and right back to the walking animation.

This seems pretty realistic to me.

AI means artificial intelligence, like path finding.
chias
Prole
Posts: 1
Joined: Sat Mar 24, 2012 6:35 pm

Re: physics simulated body that still animates

Post by chias »

PhD candidate working in an AI lab here:

You will not implement a ragdoll that walks via physics. This is a problem that we (the AI research community as a whole) have not yet managed to solve, although admittedly we are using 3d. Getting a robot to walk without toppling over is also a very difficult problem, even when the ground is perfectly flat and conditions are extremely controlled. To get an idea of the difficulty of this even in 2d, try out this lovely game http://www.foddy.net/Athletics.html .

If you want ragdollness when the zombie gets hit, you'll probably want to enable it only when it gets hit, and disable it again when it's getting up - script the walking / getting up / etc as a normal animation.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: physics simulated body that still animates

Post by tsturzl »

chias wrote:PhD candidate working in an AI lab here:

You will not implement a ragdoll that walks via physics. This is a problem that we (the AI research community as a whole) have not yet managed to solve, although admittedly we are using 3d. Getting a robot to walk without toppling over is also a very difficult problem, even when the ground is perfectly flat and conditions are extremely controlled. To get an idea of the difficulty of this even in 2d, try out this lovely game http://www.foddy.net/Athletics.html .

If you want ragdollness when the zombie gets hit, you'll probably want to enable it only when it gets hit, and disable it again when it's getting up - script the walking / getting up / etc as a normal animation.
That's what I was saying.

I realize that it's too difficult to implement walking via physics. What you said is basically exactly what I'm doing.

However if you look at the box2dFlash examples they provide a cool example of a walking robot.
The 7th example here: http://www.box2dflash.org/
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 216 guests