Arska134 Posted October 9, 2012 Share Posted October 9, 2012 This isn't right way to do ragdolls i assume...? Global ppos:TVec3 ppos = EntityPosition(soldier) ' LEFT LEG LThighp:tbody=createbodysphere(.35) positionentity LThighp,entityposition(LThigh), 1 setbodymass LThighp,1.0 entitytype LThighp,1 entityparent LThigh,LThighp setbodymass LThighp,10 SetBodyElasticity LThighp,0 LCalfp:tbody=createbodysphere(.35) positionentity LCalfp,entityposition(LCalf),1 setbodymass LCalfp,1.0 entitytype LCalfp,1 entityparent LCalf,LCalfp setbodymass LCalfp,10 SetBodyElasticity LCalfp,0 Lfootp:tbody=createbodysphere(.35) positionentity LCalfp,entityposition(Lfoot),1 setbodymass Lfootp,1.0 entitytype Lfootp,1 entityparent Lfoot,Lfootp setbodymass Lfootp,10 SetBodyElasticity Lfootp,0 LThighCalfJoint:tjoint=createjointball(LThighp,LCalfp,vec3(ppos.x+0,ppos.y+3+1.25,ppos.z+-.01)) LCalfFootJoint:tjoint=createjointball(LCalfp,LFootp,vec3(ppos.x+0,ppos.y+3+1.25,ppos.z+-.01)) Is there any examples about ragdolls? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 9, 2012 Share Posted October 9, 2012 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. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted October 9, 2012 Author Share Posted October 9, 2012 Currently my code just stretches model in strange ways. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
flachdrache Posted October 9, 2012 Share Posted October 9, 2012 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) Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
Daimour Posted October 9, 2012 Share Posted October 9, 2012 Ball Joint doesn't work properly in LE2. Try to use Hinge Joint instead. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted October 9, 2012 Author Share Posted October 9, 2012 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. Edit: Here is my "Ragdolize" function if someone want to take a look: http://pastebin.com/raw.php?i=uN9xeAfK 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... Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted October 9, 2012 Author Share Posted October 9, 2012 I played around with code and this is the "thing" what i came up... Here is code: http://pastebin.com/raw.php?i=8kqx9gXi Well... i am speechless... Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
flachdrache Posted October 9, 2012 Share Posted October 9, 2012 Mine`s better. Ps: Thats Le2.31 - I dont know Bmax or current leSdk however .... Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
Daimour Posted October 9, 2012 Share Posted October 9, 2012 I can share how I did it with LUA (file in attachment). But it doesn't work totally properly. Because of LODs... You can watch this video for details about the problem: Sorry for dirty code. soldier.lua Quote Link to comment Share on other sites More sharing options...
Arska134 Posted October 9, 2012 Author Share Posted October 9, 2012 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 )) Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted October 9, 2012 Author Share Posted October 9, 2012 I turned debugphysics on and i realized that those bodies i put on bones are huge. When i made them smaller they go through terrain. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted October 9, 2012 Share Posted October 9, 2012 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. Compare: BlitzMax: bodyp:tbody=createbodysphere(.35) 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: bodyp=CreateBodySphere(0.35) 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) 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. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted October 10, 2012 Author Share Posted October 10, 2012 Daimour: I Have same problem as you expect with my "ragdolls" they disappear in close range. :/ Same LOD problem? Thanks SweptCollision() works. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted October 10, 2012 Share Posted October 10, 2012 I Have same problem as you expect with my "ragdolls" they disappear in close range. :/ Same LOD problem? The most likely. I hadn't much time to manage this issue. So I don't know is it solvable or not. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted October 10, 2012 Author Share Posted October 10, 2012 Thanks anyways. If someone knows if this is solvable let me know. Hopefully it isn't Leadwerks Engine bug. (is it? Does anyone have made bug report?) Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Recommended Posts
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.