Jump to content

lua ragdoll and skeleton processing


flachdrache
 Share

Recommended Posts

Moin ...

long time no see. :(

Well, i want to give lua ragdolls a try.

 

I started my "extracting" all bones by naming and assigning all bones to body spheres ( the skeleton is FPSC based afaik ).

 

-- if we know that these childs are available, we can
-- select some to build the pivot rig

-- note that the distance between weighted joints in the mesh
-- cant be stretched much and that the mesh root cant be moved
-- nor scaled away from the "Bip01_Pelvis" joint

 local Bip01_Pelvis = Bip01:FindChild( "Bip01_Pelvis" )
 if Bip01_Pelvis ~= nil then
   Bip01_Pelvis:SetParent(Bip01)
 else
   Print("Could find skeleton Bip01_Pelvis")
 end

 local Bip01_Spine = Bip01_Pelvis:FindChild( "Bip01_Spine" )
 if Bip01_Spine ~= nil then
   Bip01_Spine:SetParent(Bip01_Pelvis)
 else
   Print("Could find skeleton Bip01_Spine")
 end

 local Bip01_Spine1 = Bip01_Spine:FindChild( "Bip01_Spine1" )
 if Bip01_Spine1 ~= nil then
   Bip01_Spine1:SetParent(Bip01_Spine)
 else
   Print("Could find skeleton Bip01_Spine1")
 end

 local Bip01_Spine2 = Bip01_Spine1:FindChild( "Bip01_Spine2" )
 if Bip01_Spine2 ~= nil then
   Bip01_Spine2:SetParent(Bip01_Spine1)
 else
   Print("Could find skeleton Bip01_Spine2")
 end

 local Bip01_Spine3 = Bip01_Spine2:FindChild( "Bip01_Spine3" )
 if Bip01_Spine3 ~= nil then
   Bip01_Spine3:SetParent(Bip01_Spine2)
 else
   Print("Could find skeleton Bip01_Spine3")
 end

 local Bip01_Neck = Bip01_Spine3:FindChild( "Bip01_Neck" )
 if Bip01_Neck ~= nil then
   Bip01_Neck:SetParent(Bip01_Spine3)
 else
   Print("Could find skeleton Bip01_Neck")
 end

 local Bip01_Head = Bip01_Neck:FindChild( "Bip01_Head" )
 if Bip01_Head ~= nil then
   Bip01_Head:SetParent(Bip01_Neck)
 else
   Print("Could find skeleton Bip01_Head")
 end

 local Bip01_L_Clavicle = Bip01_Neck:FindChild( "Bip01_L_Clavicle" )
 if Bip01_L_Clavicle ~= nil then
   Bip01_L_Clavicle:SetParent( Bip01_Neck)
 else
   Print("Could find skeleton Bip01_L_Clavicle")
 end

 local Bip01_L_UpperArm = Bip01_L_Clavicle:FindChild( "Bip01_L_UpperArm" )
 if Bip01_L_UpperArm ~= nil then
   Bip01_L_UpperArm:SetParent(Bip01_L_Clavicle)
 else
   Print("Could find skeleton Bip01_L_UpperArm")
 end

 local Bip01_L_Forearm = Bip01_L_UpperArm:FindChild( "Bip01_L_Forearm" )
 if Bip01_L_Forearm ~= nil then
   Bip01_L_Forearm:SetParent(Bip01_L_UpperArm)
 else
   Print("Could find skeleton Bip01_L_Forearm")
 end

 local Bip01_L_Hand = Bip01_L_Forearm:FindChild( "Bip01_L_Hand" ) -- points to "FIRESPOT"
 if Bip01_L_Hand ~= nil then
   Bip01_L_Hand:SetParent(Bip01_L_Forearm)
 else
   Print("Could find skeleton Bip01_L_Hand")
 end

 local Bip01_L_Finger0 = Bip01_L_Hand:FindChild( "Bip01_L_Finger0" )
 if Bip01_L_Finger0 ~= nil then
   Bip01_L_Finger0:SetParent(Bip01_L_Hand)
 else
   Print("Could find skeleton Bip01_L_Finger0")
 end

 local Bip01_R_Clavicle = Bip01_Neck:FindChild( "Bip01_R_Clavicle" )
 if Bip01_R_Clavicle ~= nil then
   Bip01_R_Clavicle:SetParent(Bip01_Neck)
 else
   Print("Could find skeleton Bip01_R_Clavicle")
 end

 local Bip01_R_UpperArm = Bip01_R_Clavicle:FindChild( "Bip01_R_UpperArm" )
 if Bip01_R_UpperArm ~= nil then
   Bip01_R_UpperArm:SetParent(Bip01_R_Clavicle)
 else
   Print("Could find skeleton Bip01_R_UpperArm")
 end

 local Bip01_R_Forearm = Bip01_R_UpperArm:FindChild( "Bip01_R_Forearm" )
 if Bip01_R_Forearm ~= nil then
   Bip01_R_Forearm:SetParent(Bip01_R_UpperArm)
 else
   Print("Could find skeleton Bip01_R_Forearm")
 end

 local Bip01_R_Hand = Bip01_R_Forearm:FindChild( "Bip01_R_Hand" )
 if Bip01_R_Hand ~= nil then
   Bip01_R_Hand:SetParent(Bip01_R_Forearm)
 else
   Print("Could find skeleton Bip01_R_Hand")
 end

 local Bip01_R_Finger0 = Bip01_R_Hand:FindChild( "Bip01_R_Finger0" )
 if Bip01_R_Finger0 ~= nil then
   Bip01_R_Finger0:SetParent(Bip01_R_Hand)
 else
   Print("Could find skeleton Bip01_R_Finger0")
 end

 local Bip01_L_Thigh = Bip01_Spine:FindChild( "Bip01_L_Thigh" )
 if Bip01_L_Thigh ~= nil then
   Bip01_L_Thigh:SetParent(Bip01_Spine)
 else
   Print("Could find skeleton Bip01_L_Thigh")
 end

 local Bip01_L_Calf =  Bip01_L_Thigh:FindChild( "Bip01_L_Calf" )
 if Bip01_L_Calf ~= nil then
   Bip01_L_Calf:SetParent(Bip01_L_Thigh)
 else
   Print("Could find skeleton Bip01_L_Calf")
 end

 local Bip01_L_Foot = Bip01_L_Calf:FindChild( "Bip01_L_Foot" )
 if Bip01_L_Foot ~= nil then
   Bip01_L_Foot:SetParent(Bip01_L_Calf)
 else
   Print("Could find skeleton Bip01_L_Foot")
 end

 local Bip01_L_Toe0 = Bip01_L_Foot:FindChild( "Bip01_L_Toe0" )
 if Bip01_L_Toe0 ~= nil then
   Bip01_L_Toe0:SetParent(Bip01_L_Foot)
 else
   Print("Could find skeleton Bip01_L_Toe0")
 end

 local Bip01_R_Thigh = Bip01_Spine:FindChild( "Bip01_R_Thigh" )
 if Bip01_R_Thigh ~= nil then
   Bip01_R_Thigh:SetParent(Bip01_Spine)
 else
   Print("Could find skeleton Bip01_R_Thigh")
 end

 local Bip01_R_Calf = Bip01_R_Thigh:FindChild( "Bip01_R_Calf" )
 if Bip01_R_Calf ~= nil then
   Bip01_R_Calf:SetParent(Bip01_R_Thigh)
 else
   Print("Could find skeleton Bip01_R_Calf")
 end

 local Bip01_R_Foot = Bip01_R_Calf:FindChild( "Bip01_R_Foot" )
 if Bip01_R_Foot ~= nil then
   Bip01_R_Foot:SetParent(Bip01_R_Calf)
 else
   Print("Could find skeleton Bip01_R_Foot")
 end

 local Bip01_R_Toe0 = Bip01_R_Foot:FindChild( "Bip01_R_Toe0" )
 if Bip01_R_Toe0 ~= nil then
   Bip01_R_Toe0:SetParent(Bip01_R_Foot)
 else
   Print("Could find skeleton Bip01_R_Toe0")
 end

 

but thats it :P:D - i add HingeJoints between parent & childs from given Bip01_Skeleton and the "bodySphereRig" looks somewhat OK but i have no good way to let the bodyRig drive the mesh bones e.g.

if i bind a model than the bodyRig becomes nonColiider because the parent isnt allowed to collide and if i allow the model to coliide ( setting mass and entityType to the model ) than the models own physic collider ( the phy file ) is in the way.

 

erm ... halp ?!

Tia. :)

 

The model skeleton`s "sceneRoot" is bound to the model itself ... ?!

 

-- Build the pivot skeleton
-- make sure that we can have all pivots in the model

 local Bip01 = object.model:FindChild( "Bip01" )
 if Bip01 ~= nil then
   Bip01:SetParent(object.model)
 else
   Print("Could find skeleton Bip01")
 end

AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3

zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5

 

adv_banner-april2012_720x150_tex01.png

 

Xxploration FPS in progress ...

Link to comment
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.

Guest
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.

 Share

×
×
  • Create New...