Using mouse to move object

Blitz3D Forums/Blitz3D Programming/Using mouse to move object

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Something like this should work ....

Initialise ...

plane = createplane() : entitypickmode plane, 2
target = createsphere() : entitycolor target, 255,0,0
player = createsphere()


In the main loop ....

Picked = camerapick( mousex(), mousey() )
if Picked = plane
   positionentity target, pickedx(), pickedy(), pickedz()
endif

if entitydistance( player, target ) > 10
   turnentity player, 0, deltayaw( player, target )*.1, 0
   moveentity player, 0, 0, .5
endif



The target is a sphere to show you where you're moving to .. normally a pivot would suffice here.

Hope this helps.

Stevie