Graphics3D 800, 600, 0, 2 SetBuffer BackBuffer() TOKSIM_CreateSimulator 0, -10, 0 Global cube1 = CreateCube() Global cube2 = CreateCube() Global rbCube1 = TOKRB_Create() TOKRB_AddBox(rbCube1, 2, 2, 2) TOKRB_SetPosition rbCube1, 3, 0, 0 Global abCube = TOKAB_Create() TOKAB_AddBox(abCube, 2, 2, 2) TOKAB_SetPosition abCube, 3, -4, 0 Global rbCube2 = TOKRB_Create() TOKRB_AddBox(rbCube2, 2, 2, 2) TOKRB_SetPosition rbCube2, -3, 0, 0 Global rbJoiner = TOKRB_Create() TOKRB_AddCylinder rbJoiner, 1, 6 Global jCube1 = TOKJOINT_Create(2, rbCube1, rbJoiner) TOKJOINT_SetPositionAndRotationWorld jCube1, 2, 0, 0, 0, 0, 0 TOKJOINT_SetType jCube1, 2 TOKJOINT_SetUpperLimit jCube1, 0 TOKJOINT_SetLowerLimit jCube1, 0 TOKJOINT_Enable jCube1, True Global jCube2 = TOKJOINT_Create(2, rbCube2, rbJoiner) TOKJOINT_SetPositionAndRotationWorld jCube2, -2, 0, 0, 0, 0, 0 TOKJOINT_SetType jCube2, 2 TOKJOINT_SetUpperLimit jCube2, 0 TOKJOINT_SetLowerLimit jCube2, 0 TOKJOINT_Enable jCube2, True Global abFloor = TOKAB_Create() TOKAB_AddBox abFloor, 50, 1, 50 TOKAB_SetPosition abFloor, 0, -5, 0 Global cam = CreateCamera() MoveEntity cam, 0, 0, -10 While Not KeyHit(1) Cls TOKSIM_Advance .01, 2 Position(cube1, rbcube1) position(cube2, rbcube2) RenderWorld Flip Wend Function Position(ent, rb) PositionEntity ent, TOKRB_GetX(rb), TOKRB_GetY(rb), TOKRB_GetZ(rb) RotateEntity ent, TOKRB_GetPitch(rb), TOKRB_GetYaw(rb), TOKRB_GetRoll(rb) End Function
Im trying to make it like there is a pole holding two rigid bodies together, so that they are completely locked together. That code above is what i thought does it.. but i cnat get it to work :\