Here's a little sheep herding demo based off of Toms Galloping code. Maybe you coud make the sheep gallop ;)
Arrow keys move the sheep dog
Arrow keys move the sheep dog
;sheep herder based on Toms code ;Arbitrage ; Joint tests, trying to simulate vehicle axles ; ; I got a galloping car instead hehe ; ; Scouse Const FPS=50 Graphics3D 800,600,0,2 SetBuffer BackBuffer() WireFrame False Const ENTS=200 camera = CreateCamera() PositionEntity camera,-5,8,-10 TOKSIM_CreateSimulator(ENTS,5,0,-10,0) ground = CreateCube() EntityColor ground,5,5,55 ScaleEntity ground,50,5,50 PositionEntity ground,0,-5,0 abground = TOKAB_Create() TOKAB_AddBox(abground,100.0,10.0,100.0) TOKAB_SetPosition(abground,0.0,-5.0,0.0) wall1 = CreateCube() EntityColor wall1,25,25,55 ScaleEntity wall1,2,10,50 PositionEntity wall1,50,0,0 abwall1 = TOKAB_Create() TOKAB_AddBox(abwall1,4.0,20.0,100.0) TOKAB_SetPosition(abwall1,50.0,0,0.0) wall2 = CreateCube() EntityColor wall2,25,25,55 ScaleEntity wall2,2,10,50 PositionEntity wall2,-50,0,0 abwall2 = TOKAB_Create() TOKAB_AddBox(abwall2,4.0,20.0,100.0) TOKAB_SetPosition(abwall2,-50.0,0,0.0) wall3 = CreateCube() EntityColor wall3,25,25,55 ScaleEntity wall3,50,10,2 PositionEntity wall3,0,0,-50 abwall3 = TOKAB_Create() TOKAB_AddBox(abwall3,100.0,20.0,4.0) TOKAB_SetPosition(abwall3,0.0,0,-50.0) wall4 = CreateCube() EntityColor wall4,25,25,55 ScaleEntity wall4,50,10,2 PositionEntity wall4,0,0,50 abwall4 = TOKAB_Create() TOKAB_AddBox(abwall4,100.0,20.0,4.0) TOKAB_SetPosition(abwall4,0.0,0,50.0) Dim obj(ENTS) Dim rb(ENTS) obj(1) = CreateCube() ScaleEntity obj(1),.5,.5,.5 rb(1) = TOKRB_Create() TOKRB_AddBox rb(1),1.0,1.0,1.0 ;TOKRB_CollideConnected rb(1),True TOKRB_SetPosition rb(1),0,2,0 PositionEntity obj(1),0,2,0 TOKRB_SetLinearDamping rb(1),0.05 TOKRB_SetAngularDamping rb(1),0.05 TOKRB_SetMass rb(1),2.0 TOKRB_SetBoxInertiaTensor rb(1),1,1,2,2.0 Xpos =-20 Zpos =-10 For x = 2 To 200 Xpos=Xpos +2 If Xpos>20 Zpos=Zpos +2 Xpos=-20 If ZPos > 10 Then Zpos=-10 EndIf obj(x) = CreateCube() ScaleEntity obj(x),.5,.5,.5 rb(x) = TOKRB_Create() TOKRB_AddBox rb(x),1.0,1.0,1.0 ;TOKRB_CollideConnected rb(1),True TOKRB_SetPosition rb(x),Xpos,2,Zpos PositionEntity obj(x),Xposx,2,Zpos TOKRB_SetLinearDamping rb(x),0.01 TOKRB_SetAngularDamping rb(x),0.01 TOKRB_SetMass rb(x),2.0 TOKRB_SetBoxInertiaTensor rb(x),1,1,2,2.0 Next ;obj(i) = CreateCylinder() ;rb(i) = TOKRB_Create() ;TOKRB_AddCylinder rb(i),2.0,1.0 ;TOKRB_SetPosition(rb(i),x#,2+i*0.2,z#) ;TOKRB_SetAngularDamping rb(i),0.02 ;TOKRB_SetLinearDamping rb(i),0.001 ;TOKRB_SetMass rb(i),2.0 ;TOKRB_SetCylinderInertiaTensor rb(i),2.0,1.0,2.0 ;EntityColor obj(i),Rnd(100,230),Rnd(100,230),Rnd(100,230) Centerpivot = CreatePivot() light=CreateLight() PositionEntity light,7,15,-5 PointEntity light,Centerpivot rot#=0 period=1000/FPS time=MilliSecs()-period imptime=MilliSecs() ; MainLoop While Not KeyHit(1) Repeat elapsed=MilliSecs()-time Until elapsed ticks=elapsed/period tween#=Float(elapsed Mod period)/Float(period) For k=1 To ticks time=time+period If k=ticks Then CaptureWorld TOKSIM_Advance(1.0/FPS) If rot#>360 Then rot#=0 ;PositionEntity camera,camx#,40,camz# PositionEntity camera,EntityX(obj(1)),EntityY(obj(1))+15,EntityZ(obj(1))-+10 PointEntity camera,obj(1) UpdateWorld Next ; Not sure wether to put this here or inside the for/next above... For i=1 To 200 If TOKRB_IsIdle(rb(i)) Then EntityAlpha obj(i),0.5 Else EntityAlpha obj(i),1.0 EndIf PositionEntity obj(i),TOKRB_GetX#(rb(i)),TOKRB_GetY#(rb(i)),TOKRB_GetZ#(rb(i)) RotateEntity obj(i),TOKRB_GetPitch#(rb(i)),TOKRB_GetYaw#(rb(i)),TOKRB_GetRoll#(rb(i)),False Next If KeyDown(200) Then TOKRB_ApplyImpulse rb(1),0,0,5*ticks EndIf If KeyDown(208) Then TOKRB_ApplyImpulse rb(1),0,0,-5*ticks EndIf If KeyDown(205) Then TOKRB_ApplyImpulse rb(1),5*ticks,0,0 EndIf If KeyDown(203) Then TOKRB_ApplyImpulse rb(1),-5*ticks,0,0 EndIf RenderWorld tween Text 0,0,"Physics Time:"+TOKSIM_GetPhysicsTime()*1000.0+ " milliseconds" Text 0,10,"Render Time:"+Str(elapsed)+ " milliseconds" Flip False Wend TOKSIM_DestroySimulator() End