Beautiful! Beautiful! Beautiful!
Math is strong with this one
In TBGL it is possible to make one graphic element looking at other using TBGL_EntityLookAt, to do what you need could be achieved with this then:
' -- Measure distance cylinder-sphere
distance = TBGL_EntityGetDistance(%sScene, %eCylinder, %eSphere)
' -- Destroy old cylinder
TBGL_EntityDestroy(%sScene, %eCylinder)
' -- Make new
TBGL_EntityCreateCylinder(%sScene, %eCylinder, 0, 0.1, 0.1, distance, 0, 255, 255, 255)
' -- Make the entity eCylinder to be looking at eSphere (with +Z)
TBGL_EntitySetTarget(%sScene, %eCylinder, %eSphere)
' -- We want to make it look with +Y, lets turn it around X then
TBGL_EntityTurn(%sScene, %eCylinder, 90, 0, 0)
I attach basic example with one cylinder and sphere you can move in realtime using arrows.
Petr
Bookmarks