mouse control
Blitz3D Forums/Blitz3D Beginners Area/mouse control
| ||
can someone give me a simple example of code that if the player clicks with the mouse on a mesh the character moves from his postion to the position clicked on by the mouse. i know it has something to do with camera project but ive not made a game with mouse control before? i know how to select characters and objects with camera picks but i don't know how to pick a spot on a mesh ? please keep any examples simple because i rubbish at 3d. |
| ||
Maybe somthing like this?;on the mesh being picked EntityPickMode mesh,2 If Mousehit(1) ; if the left mousebutton is hit pick= CameraPick(camera,MouseX(),MouseY()) If pick <> 0 x# = PickedX() y# = PickedY() z# = PickedZ() Positionentity Character,x#,y#,z# EndIf EndIf camerapick returns the exact values of where it was picked, so that would be your "spot" on the mesh. You can get the coords from camerapick by storing pickedx(), pickedy(), and pickedz() in float points. Then you just move to that location. |
| ||
thanks mate i was doing it alittle bit wrong but now ive sean your code ive got it working. ive got very rusty havent done anything in blitz3d for ages so forgoten alot. thanks again |