An intriguing challenge with physics

Blitz3D Forums/Blitz3D Programming/An intriguing challenge with physics

Um... Isn't this really really simple?

Graphics3D 640,480,16,2


MoveMouse 320,240

b1=CreateCube()
b2=CreateCube()

camera=CreateCamera()
MoveEntity camera,0,0,-20


Repeat

x#=(MouseX()-320)*.065
y#=(-MouseY()+240)*.065


PositionEntity b1,x,y,0


; the complex maths bit
PointEntity b2,b1
MoveEntity b2,0,0,EntityDistance(b1,b2)-5 ;where 5 is how far away you want it to be


UpdateWorld
RenderWorld

Flip

Until KeyHit(1)