The "Get Limb Parent" Matrix1 command works correctly.
We discovered that the "Load Object" command does not import the Limb Parent relationships correctly. This was a confirmed bug with the "Load Object" command.
http://forum.thegamecreators.com/?m=forum_view&t=163815&b=15
We wrote a DBPro plugin which repairs the objects hierarchy after it is loaded. The DBPro plugin and .ini file are attached.
We updated your code to use the command from our DBPro plugin.
This eliminates the need for you to hard code your objects hierarchy.Hope this helps your projects.
sync on
sync rate 60
load object "playerbase.x",1
load object "playerbase.x",2
// added by Stab In The Dark Software
//To use sd repair hierarchy you need attached dll.
sd repair hierarchy 1
sd repair hierarchy 2
position object 1,-3,0,0
position object 2,3,0,0
rotate object 1,0,45,0
rotate object 2,0,45,0
position camera 0,0,-8
point camera 0,0,0
set object speed 1,15
loop object 1
//Starting angles of all limbs in object
type Vector3
X as float
Y as float
Z as float
endtype
DIM limbinitial(21) as Vector3
for c=0 to get limb count(2)
limbinitial(c).X = limb direction x(2,c)
limbinitial(c).Y = limb direction y(2,c)
limbinitial(c).Z = limb direction z(2,c)
next c
do
for c=0 to get limb count(2)
text 450,14*(c+2),str$(c)
text 500,14*(c+2),str$(get Limb Parent(2,c))
text 550,14*(c+2),limb name$(2,c)
rotate limb 2,c,getLimbAngleX(1,c),getLimbAngleY(1,c),getLimbAngleZ(1,c)
next c
text object screen x(1),object screen y(1),"SOURCE"
text object screen x(2),object screen y(2),"RESULT"
sync
loop
function getLimbAngleX(object as integer, limb as integer)
if limb > -1
ret# = limb direction x(object,limb) - limbinitial(limb).X - getLimbAngleX(object,get Limb Parent(object,limb))
else
ret# = 0.0
endif
endfunction ret#
function getLimbAngleY(object as integer, limb as integer)
if limb > -1
ret# = limb direction y(object,limb) - limbinitial(limb).Y - getLimbAngleY(object,get Limb Parent(object,limb))
else
ret# = 0.0
endif
endfunction ret#
function getLimbAngleZ(object as integer, limb as integer)
if limb > -1
ret# = limb direction z(object,limb) - limbinitial(limb).Z - getLimbAngleZ(object,get Limb Parent(object,limb))
else
ret# = 0.0
endif
endfunction ret#
[img]

[/img]





WindowsXP SP1,Vista,Windows 7 DBpro v7.61
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.