TOKSIM_GetGravityY() |
Return value: The Y component of the current gravity |
Description: Retrieves the Y component of the current gravity. |
A demo of setting and retrieving gravity Const Rigid_Bodies=1,Animated_Bodies=1 TOKSIM_SetRigidBodiesCount Rigid_Bodies TOKSIM_SetAnimatedBodiesCount Animated_Bodies TOKSIM_SetRigidParticleCount 0 TOKSIM_SetControllersCount 0 TOKSIM_SetGeometriesCount Rigid_bodies+Animated_Bodies ;Assuming each one only has one geometry. Not true with more complex rigid bodies and animated bodies. TOKSIM_CreateSimulator(0,0,0) Graphics3D 640,480 cam=CreateCamera() PositionEntity cam,0,0,-20 Sun=CreateSphere(16) ScaleEntity sun,5,5,5 Sunab=TOKAB_Create() TOKAB_AddSphere Sunab,10 earth=CreateSphere(8) earthrb=TOKRB_Create() TOKRB_AddSphere earthrb,2 TOKRB_SetPosition earthrb,10,0,-20 l=CreateLight() While Not KeyHit(1) TOKSIM_Advance .1,1 TOKRB_ApplyImpulse earthrb,(KeyDown(205)-KeyDown(203))*.1,0,(KeyDown(200)-KeyDown(208))*.1 PositionEntity earth,TOKRB_GetX(earthrb),TOKRB_GetY(earthrb),TOKRB_GetZ(earthrb) TFormNormal TOKRB_GetX(earthrb),TOKRB_GetY(earthrb),TOKRB_GetZ(earthrb),0,0 TOKSIM_SetGravity -.5*TFormedX(),-.5*TFormedY(),-.5*TFormedZ() RenderWorld Text 0,5,"Gravity X:"+TOKSIM_GetGravityX() Text 0,20,"Gravity Y:"+TOKSIM_GetGravityY() Text 0,35,"Gravity Z:"+TOKSIM_GetGravityZ() Flip Wend TOKSIM_DestroySimulator |