Im looking at ways to move a 3D object so that its follows the cursor.
I cant seem to quite make it follow exactly how I want ... would appreciate any input.
I'm sure there is a better way to achieve this.
Westa
SetVirtualResolution( 1024, 768)
SetCameraPosition(1,0,0,-500)
SetCameraLookAt(1,0,0,0,0)
// create cone ... reset its pivot to tip of cone
CreateObjectCone(2,30,10,10)
SetObjectPosition(2,0,-15,0)
FixObjectPivot(2)
// make the cone 'look' at center of 3D space
SetObjectLookAt(2,0,0,0,0)
// align cone along axis
RotateObjectLocalX(2 , 90 )
// main loop
do
x# = GetPointerX ( )
y# = GetPointerY ( )
unit_x# = Get3DVectorXFromScreen(x#,y#)* GetDeviceWidth() / 4
unit_y# = Get3DVectorYFromScreen(x#,y#)* GetDeviceHeight() / 3
unit_z# = -300 // Get3DVectorZFromScreen(x#,y#)* 250
SetObjectPosition( 2 , unit_x#, unit_y# , unit_z#)
sync()
loop