Mike I posted this up a while a go but was not able to get a response.
Here is my code below in an attempt to create a "skinned" ragdoll:
global objMODEL as byte = 100
`Below will be used to represent objects for rigid bodies
global objBODY01 as byte = 101
global objBIP01 as byte = 103
global objPELVIS as byte = 104
global objSPINE as byte = 105
global objRTHIGH as byte = 106
global objRCALF as byte = 107
global objRFOOT as byte = 108
global objRTOE0 as byte = 109
global objLTHIGH as byte = 114
global objLCALF as byte = 115
global objLFOOT as byte = 116
global objLTOE0 as byte = 117
global objSPINE1 as byte = 122
global objSPINE2 as byte = 123
global objNECK as byte = 124
global objRCLAV as byte = 125
global objRUPPERARM as byte = 126
global objRFOREARM as byte = 127
global objRHAND as byte = 128
global objRFINGER0 as byte = 129
global objLCLAV as byte = 135
global objLUPPERARM as byte = 136
global objLFOREARM as byte = 137
global objLHAND as byte = 138
global objLFINGER0 as byte = 141
global objHEAD as byte = 147
`Actual Indices for the limbs from the model that will be loaded
global limbBODY01 as byte = 1
global limbBIP01 as byte = 3 `This is the start of the skeleton
global limbPELVIS as byte = 4
global limbSPINE as byte = 5
global limbRTHIGH as byte = 6
global limbRCALF as byte = 7
global limbRFOOT as byte = 8
global limbRTOE0 as byte = 9
global limbLTHIGH as byte = 14
global limbLCALF as byte = 15
global limbLFOOT as byte = 16
global limbLTOE0 as byte = 17
global limbSPINE1 as byte = 22
global limbSPINE2 as byte = 23
global limbNECK as byte = 24
global limbRCLAV as byte = 25
global limbRUPPERARM as byte = 26
global limbRFOREARM as byte = 27
global limbRHAND as byte = 28
global limbRFINGER0 as byte = 29
global limbLCLAV as byte = 35
global limbLUPPERARM as byte = 36
global limbLFOREARM as byte = 37
global limbLHAND as byte = 38
global limbLFINGER0 as byte = 41
global limbHEAD as byte = 47
load object "models\aiko\aiko.x",objMODEL
perform checklist for object limbs objMODEL
numLimbs=checklist quantity()
phy start
for limb = 1 to numLimbs - 1
s$ = limb name$(objMODEL, limb)
if s$ <> "FIRESPOT" AND s$ <> "$NoName$"
`build the physic objects that will be used in ragdoll
make object cube 100+limb, 3
position object 100+limb, limb position x(objMODEL, limb),limb position y(objMODEL, limb),limb position z(objMODEL, limb)
` Rotate each object to limb direction
xrotate object 100+limb, limb direction x(objMODEL, limb)
yrotate object 100+limb, limb direction y(objMODEL, limb)
zrotate object 100+limb, limb direction z(objMODEL, limb)
phy make rigid body dynamic box 100+limb
endif
next limb
`Make Ragdoll
phy make rag doll objMODEL, objMODEL, objBIP01 `objBIP01 should be start of skeleton???
`Assign each limb to object
phy assign rag doll part objMODEL, 0, limbBODY01, objBODY01
phy assign rag doll part objMODEL, 0, limbBIP01, objBIP01
phy assign rag doll part objMODEL, 0, limbPELVIS, objPELVIS
phy assign rag doll part objMODEL, 0, limbSPINE, objSPINE
phy assign rag doll part objMODEL, 0, limbRTHIGH, objRTHIGH
phy assign rag doll part objMODEL, 0, limbRCALF, objRCALF
phy assign rag doll part objMODEL, 0, limbRFOOT, objRFOOT
phy assign rag doll part objMODEL, 0, limbRTOE0, objRTOE
phy assign rag doll part objMODEL, 0, limbLTHIGH, objLTHIGH
phy assign rag doll part objMODEL, 0, limbLCALF, objLCALF
phy assign rag doll part objMODEL, 0, limbLFOOT, objLFOOT
phy assign rag doll part objMODEL, 0, limbLTOE0, objLTOE0
phy assign rag doll part objMODEL, 0, limbSPINE1, objSPINE1
phy assign rag doll part objMODEL, 0, limbSPINE2, objSPINE2
phy assign rag doll part objMODEL, 0, limbNECK, objNECK
phy assign rag doll part objMODEL, 0, limbRCLAV, objRCLAV
phy assign rag doll part objMODEL, 0, limbRUPPERARM, objRUPPERARM
phy assign rag doll part objMODEL, 0, limbRFOREARM, objRFOREARM
phy assign rag doll part objMODEL, 0, limbRHAND, objRHAND
phy assign rag doll part objMODEL, 0, limbRFINGER0, objRFINGER0
phy assign rag doll part objMODEL, 0, limbLCLAV, objLCLAV
phy assign rag doll part objMODEL, 0, limbLUPPERARM, objLUPPERARM
phy assign rag doll part objMODEL, 0, limbLFOREARM, objLFOREARM
phy assign rag doll part objMODEL, 0, limbLHAND, objLHAND
phy assign rag doll part objMODEL, 0, limbLFINGER0, objLFINGER0
phy assign rag doll part objMODEL, 0, limbRHAND, objHEAD
`Make fixed joints for simplicity
phy make fixed joint 1, objBIP01, objPELVIS: phy build fixed joint 1
phy make fixed joint 2, objPELVIS, objSPINE: phy build fixed joint 2
phy make fixed joint 3, objSPINE, objSPINE1: phy build fixed joint 3
phy make fixed joint 4, objSPINE1,objSPINE2: phy build fixed joint 4
phy make fixed joint 5, objSPINE2,objNECK: phy build fixed joint 5
phy make fixed joint 6, objNECK,objHEAD: phy build fixed joint 6
phy make fixed joint 7, objPELVIS, objRTHIGH: phy build fixed joint 7
phy make fixed joint 8, objRTHIGH, objRCALF: phy build fixed joint 8
phy make fixed joint 9, objRCALF, objRFOOT: phy build fixed joint 9
phy make fixed joint 10, objRFOOT, objRTOE0: phy build fixed joint 10
phy make fixed joint 11, objPELVIS, objLTHIGH: phy build fixed joint 11
phy make fixed joint 12, objLTHIGH, objLCALF: phy build fixed joint 12
phy make fixed joint 13, objLCALF, objLFOOT: phy build fixed joint 13
phy make fixed joint 14, objLFOOT, objLTOE0: phy build fixed joint 14
phy make fixed joint 15, objNECK, objRCLAV: phy build fixed joint 15
phy make fixed joint 16, objRCLAV, objRUPPERARM: phy build fixed joint 16
phy make fixed joint 17, objRUPPERARM, objRFOREARM: phy build fixed joint 17
phy make fixed joint 18, objRFOREARM, objRHAND: phy build fixed joint 18
phy make fixed joint 19, objRHAND, objRFINGER0: phy build fixed joint 19
phy make fixed joint 20, objNECK, objLCLAV: phy build fixed joint 20
phy make fixed joint 21, objLCLAV, objLUPPERARM: phy build fixed joint 21
phy make fixed joint 22, objLUPPERARM, objLFOREARM: phy build fixed joint 22
phy make fixed joint 23, objLFOREARM, objLHAND: phy build fixed joint 23
phy make fixed joint 24, objLHAND, objLFINGER0: phy build fixed joint 24
`Make box
make object box 51, 200, 5, 200: position object 51, 0,-25,0
phy make rigid body static box 51
autocam off
backdrop on
sync on: sync rate 60
set ambient light 80
position camera 20,80,-100
yrotate camera 0
Do
phy update
sync
Loop
phy end
I used the aiko.X model I got from AI tech demo. I made fixed joints for simplicity. Now the actual ragdoll works. The problem is assigning aiko.X to the ragdoll
Problems:
1st the mesh gets distorted.
2nd the mesh simply does not deform to the ragdoll.
Some questions about the code:
phy make rag doll objMODEL, objMODEL, objBIP01 `objBIP01 should be start of skeleton???
Do I use objBIP01 since that object is supposed to be the parent of the rest of the skeleton?
phy assign rag doll part objMODEL, 0, limbBODY01, objBODY01
Do I use "0" for the mesh assignment?
Any help, especially anyone who has working code would be great!!
Along these lines, will you provide another "skinned" ragdoll character?
Thanks Mike.