I am using Physx to move some objects and ezrotate to handle the mouse movements...
in order to keep the ezrotate angles from messing up I need to shadow a moving physx object by matching the position step for step.
This is the code I came up with.
Anybody have a "cleaner solution?"
Xold# = OBJECT POSITION X(16)
Yold# = OBJECT POSITION Y(16)
Zold# = OBJECT POSITION Z(16)
phy update
SYNC
` AFTER SYNC _______________________________________________
` AFTER SYNC _______________________________________________
X#=object position x(16)
Y#=object position y(16)
Z#=object position z(16)
` shadow the moving object 16
` with the rotating object 110
` find the distances change of the moving object
if Xold#<>X#
if Xold#>X#
capxx#=Xold#-X#
capx=-1
capxx#=capxx#*capx
else
capxx#=X#-Xold#
capx=1
capxx#=capxx#*capx
endif
endif
if Yold#<>Y#
if Yold#>Y#
capyy#=Yold#-Y#
capy=-1
capyy#=capyy#*capy
else
capyy#=Y#-Yold#
capy=1
capyy#=capyy#*capy
endif
endif
if Zold#<>Z#
if Zold#>Z#
capzz#=Zold#-Z#
capz=-1
capzz#=capzz#*capz
else
capzz#=Z#-Zold#
capz=1
capzz#=capzz#*capz
endif
endif
` match the change in distances with the calculated moves
` with the orbiter
position object 110,object position x(110)+capxx#,object position y(110)+capyy#, object position z(110)+capzz#