Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

This isn't right way to do ragdolls i assume...?


Global ppos:TVec3
ppos = EntityPosition(soldier)

positionentity LThighp,entityposition(LThigh), 1
setbodymass LThighp,1.0
entitytype LThighp,1
entityparent LThigh,LThighp
setbodymass LThighp,10
SetBodyElasticity LThighp,0

positionentity LCalfp,entityposition(LCalf),1
setbodymass LCalfp,1.0
entitytype LCalfp,1
entityparent LCalf,LCalfp
setbodymass LCalfp,10
SetBodyElasticity LCalfp,0

positionentity LCalfp,entityposition(Lfoot),1
setbodymass Lfootp,1.0
entitytype Lfootp,1
entityparent Lfoot,Lfootp
setbodymass Lfootp,10
SetBodyElasticity Lfootp,0



Is there any examples about ragdolls?

Link to post
Share on other sites

The code you provided does look a lot like how I would probably do it. I would loop through the bone hierarchy and create a physics body for a bone. Ofcourse you could be finetuning it and only create the bodies for the bones that you want. Certain bones have limitations in the amount they should rotate.

Link to post
Share on other sites

Try to Vec3.Zero position/rotation for the bones after positioning the new driver but before parenting them to the bones - in your code something like :


positionentity LCalfp,entityposition(Lfoot),1
setbodymass Lfootp,1.0
entitytype Lfootp,1

Lfootp.rotation =Vec3{0,0,0}
Lfootp.position =Vec3{0,0,0}

entityparent Lfoot,Lfootp


Ps : this has to happen in the moment the ragdoll becomes valid (set a animation frame and switch to ragdoll)

Link to post
Share on other sites

Ball Joint doesn't work properly in LE2. Try to use Hinge Joint instead.

About CreateJointHinge... What is pin parameter and what values should i use when making ragdolls?

Another question. Should my ragdoll work right if i only make one leg as ragdoll?


I would really really appreciate some kind of example about ragdolls. I have no idea how these work.




Here is my "Ragdolize" function if someone want to take a look:



As pin parameter there is only Vec3(0,0,1) as in command example, because i don't know what it stands for.


Yes, only left leg is tried to make ragdoll like.


Edit 2:

I just found that i misplaced global parameters in entityposition function. I fixed it and it looks little bit better, but it still can't be identified as human body.


Edit 3:

Looks like it's taking shape when i add more joints...

Link to post
Share on other sites

Well.. i don't really know LUA, but thanks Daimour.

If someone take a look my code and knows what problem might be. Let me know.


And... how those numbers at end of the line should be set, and how do i know they need to be that way?

CreateJointHinge( pelvisp, spinep, vec3(ppos.x,ppos.y,ppos.z), vec3(0,0,0 ))

Link to post
Share on other sites

Well.. i don't really know LUA.

LUA is not far from BlitzMax. It has variables and functions. And it has the same functions from Leadwerks API.





positionentity bodyp,entityposition(body,1)
setbodymass bodyp,1.0
entitytype bodyp,1
'rotateentity(bodyp, vec3(0,0,0))
'positionentity(bodyp, vec3(0,0,0))
entityparent body,bodyp
setbodymass bodyp,1
SetBodyElasticity bodyp,0


And LUA-code:





--RotateEntity(bodyp, Vec3(0,0,0))

--PositionEntity(bodyp, Vec3(0,0,0))





Moreover, you don't need to read whole that file. Just find calls for function CreateJoint() and look around.

I doubt someone will tune up your bones and physics bodies. It's hard hard work. May be you could find needed digits in my example if you would read it.


When i made them smaller they go through terrain.

Try to use SweptCollision() for bodies.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...