Post by Roxas on Apr 18, 2007 15:13:12 GMT 1
Its hard to explain... Well it just like explodes!!! Sometimes i shoot it or if my C4 Explodes in my game..
[href=http://www.youtube.com/watch?v=yvP2FAJSNjo]Heres[/href] a video to explain all of this..
And my ragdoll shooting code.. lol
?:-|
[href=http://www.youtube.com/watch?v=yvP2FAJSNjo]Heres[/href] a video to explain all of this..
And my ragdoll shooting code.. lol
Function RagdollShoot(power,c4)
`this part is for object dragging... slightly complicated, ignore it if you don't understand it! :P
`shoot a ray!
wepobj=Weapon(Player(MyId).weaponid,MyID).obj
weaponrange=Player(MyID).weaponrange
if c4=0
NDB_SetVector 1, object position x(wepobj),object position y(wepobj),object position z(wepobj)
NDB_SetVector 2, object position x(weaponrange),object position y(weaponrange),object position z(weaponrange)
dist# = NDB_NewtonWorldRayCast(0)
dragBody = NDB_RayCastGetBody(1)
Omg$=str$(DragBody)
Omg2$=str$(dist#)
if dragBody<>0
NDB_SetVector 1, power,power,power
NDB_SetVector 2, power,power,power
`okay get the rotation matrix for the body.
NDB_NewtonWorldUnFreezeBody DragBody
NDB_NewtonBodySetAutoFreeze DragBody, 0
NDB_NewtonBodyGetMatrix DragBody
NDB_SetVector 1, power,power,power
`unrotate the point by this matrix
NDB_UntransformVector 1, 1
`drag the object here!
NDB_NewtonBodyGetMatrix DragBody
NDB_SetVector 1, power,power,power
NDB_TransformVector 1, 2
`setup global force.
NDB_SetVector 1, power,power,power
NDB_SetVector 2, power,power,power
NDB_BodyAddForceGlobal DragBody
endif
else
for x=1 to MaxRags
if NDB_BodyExist( x ) then dragBody=x else dragBody=0
dragBody = x
Omg$=str$(DragBody)
Omg2$=str$(dist#)
if dragBody<>0
NDB_SetVector 1, 5,power,5
NDB_SetVector 2, 5,power,5
`okay get the rotation matrix for the body.
NDB_NewtonWorldUnFreezeBody DragBody
NDB_NewtonBodySetAutoFreeze DragBody, 0
NDB_NewtonBodyGetMatrix DragBody
NDB_SetVector 1, 5,power,5
`unrotate the point by this matrix
NDB_UntransformVector 1, 1
`drag the object here!
NDB_NewtonBodyGetMatrix DragBody
NDB_SetVector 1, 5,power,5
NDB_TransformVector 1, 2
`setup global force.
NDB_SetVector 1, 5,power,5
NDB_SetVector 2, 5,power,5
NDB_BodyAddForceGlobal DragBody
endif
next x
endif
Endfunction
?:-|