Hi,
I need to make an object roate around another when it gets close to it. I.e it comes in close, does a 180 spin around the object and slingshots back the way it comes...
I have managed to get two simple shapes get close. One spins on it's pivot while moving.
When they get close enough I try to unparent the pivot and then re-parent the pivot and shape to the pivot of the other object so they can rotate around that. But it doesn't appear to work.
This is what I have:
Can some one tell me what I am doing wrong, or if I am approaching this from totaly the wrong angle.
Any thoughts are very welcomed on this.
Thanks
Max
I need to make an object roate around another when it gets close to it. I.e it comes in close, does a 180 spin around the object and slingshots back the way it comes...
I have managed to get two simple shapes get close. One spins on it's pivot while moving.
When they get close enough I try to unparent the pivot and then re-parent the pivot and shape to the pivot of the other object so they can rotate around that. But it doesn't appear to work.
This is what I have:
Graphics3D 800,600 SetBuffer BackBuffer() camera=CreateCamera() CameraViewport camera,0,0,800,600 light=CreateLight() cp1=CreatePivot() cube1=CreateCube(cp1) PositionEntity cp1,10,3,15 cp2=CreatePivot() cube2=CreateSphere(20,cp2) PositionEntity cube2,-10,0,15 EntityColor cube2,0,255,0 Dir=1 While Not KeyHit(1) TurnEntity cube1,0,0,1 If Dir=1 MoveEntity cp1,-0.1,0,0 EndIf If Dir=2 MoveEntity cp1,0.2,0,0 EndIf dist=EntityDistance(cube1,cube2) If dist<5 Dir=2 EntityParent(cube1,0) EntityParent(cube1,cp2) EntityParent(cp1,cp2) For c=0 To 360 RotateEntity cube1,0,0,-.5 RotateEntity cp1,0,0,-.5 UpdateWorld RenderWorld Flip Next EntityParent(cube1,0) EntityParent(cp2,0) EntityParent(cub1,cp2) EndIf UpdateWorld RenderWorld Flip Wend End
Can some one tell me what I am doing wrong, or if I am approaching this from totaly the wrong angle.
Any thoughts are very welcomed on this.
Thanks
Max