VeTaL Posted May 14, 2011 Share Posted May 14, 2011 Ragdoll troubles This post is connected with: Soamp's post about yellow boxes http://www.leadwerks.com/werkspace/topic/3186-blue-and-yellow-boxes/page__pid__29304#entry29304 Marleys Ghost's post about LODs management http://www.leadwerks.com/werkspace/topic/3129-freeentity/page__p__28720__fromsearch__1#entry28720 I wrote this post in some hours, so this is quite serious work. All tests are done with the LESoldierEntityAndGame entity with updated LUA-script with prototype of ragdoll But lets start from the very begining: 1) What is the yellow box, which is stretching from (0,0,0) ? 2) how to force updating bounding box to the size of the model in current frame? Enemy is dead, but its bbox is still standing as bbox of the first frame (the yellow bboxes are annoying, but thie refers to 1 question) 3) LOD and animation While trying to animate only current LOD Animate(self.model, ((AppTime()+self.timeOffset)/1000.0) * class.NTSC_FPS, blend, self.currentAnim-1, 1) the animation will reset while LOD changing. (When camera if flying closer, the LOD is changes, and animation resets) So, its needed to animate all LODs of the model: for childId = 1, self.lodCount do local child = self.lods[childId] Animate(child, --self.model, ((AppTime()+self.timeOffset)/1000.0) * class.NTSC_FPS, blend, self.currentAnim-1, 1) end 4) Number of LODs Try to add into function object:updateAnimation() next code: AppLog("CountChildren = "..CountChildren(self.model)) Result (distance is some abstract value, just for beign clean): when you're close to solider (distance is 1), it shows 4 when the distance is 2, it shows 3 (but this is the number of LODs, its supposed to be a constant!) when the distance is 5, it shows it shows 2 when the distance is more that 10, it shows 1 when the distance is again closer than 10, its still 1 [!!!] when the diastance is less then 5, its 1 and finally, if we get closer to the mode, it shows that th number of childern is still 1 [wth?] 4.1) As LODs are lost - we can try to remember them. (but this is looking like hack: i dont think that Josh wanted programer to use LOD in this way) --count and remember lods for childId = 1, CountChildren(model) do local child = GetChild(model, childId) if child:GetClass() == ENTITY_MESH then object.lodCount = object.lodCount + 1 object.lods[object.lodCount] = child end end In this case, i kill solider: and get this unholy thing: So, LODs are moving somewhere, idk where. Physics debug: moment of "death": LOD changing after death: Onr more screenshot without physic debug: 4.2) Okay, now we can try to reset position of LODs after LOD changing. for childId = 1, self.lodCount do local child = self.lods[childId] PositionEntity(child, EntityPosition(self.model, 1), 1) RotateEntity(child, EntityRotation(self.model, 1), 1) UpdateMesh(child) end And we will see the next thing: right after death, there is a huge lag (about 2 seconds), because of updating LODs position. Now there are no artifacts like before, BUT: As we are close enough, we can see this: Yellow box is sratching somewhere As we step back, here is wat you see: what is bad in this? Only invisibility of the body: + 2 sec lag during death Without debug: Step back: 5) Problem with ball joints. They are not work properly, so i was needed to use hinge joint, which is not good. (see attach) 5.1) SetJointCollisionMode doesnt work at all 5.2) SetBallJointLimits doesnt work at all 5.3) joint:SetLimits doesnt work at all PS: i'm too tired, if its needed to upload this report by parts to bugtracker - please, so it somebody else. PPS: i forgot about one more 6) I can't drag created ragdoll body with mouse+shift, but i can drug oildrum. Test_Ragdoll 2011-05-14 (ball join doesnt work).zip Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted May 18, 2011 Author Share Posted May 18, 2011 Josh, how are you with fixing this ? PS: another quite actual request http://www.leadwerks.com/werkspace/topic/3213-userdata-uniforms/ Working on LeaFAQ Link to comment Share on other sites More sharing options...
Josh Posted May 26, 2011 Share Posted May 26, 2011 Please use the bug tracker. There's no way I can remember different forum posts throughout the site. My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts