3D character rotating related 2D mouse pointer
Blitz3D Forums/Blitz3D Programming/3D character rotating related 2D mouse pointer
| ||
do you guys still remember 'gyroman'... who did the demo? can i get the codes, or else can u guys show me how to rotate the character in 3d space related to the position of 2d mouse pointer on the screen? any idea? |
| ||
You need to put the character above a mesh, createplane() will do fine. Make that mesh pickable. Now use camerapick() with mousex() and mousey() and positionentity a pivot at pickedx(), pickedy() and pickedz(). Now pointentity your character at the pivot. Cheers, Ryan |
| ||
Are planes pickable? I seem to remember they're not but I could be wrong. :) |
| ||
I'm not at home so I can't test it but I don't see why they shouldn't be? Just set the entitypickmode and it should be fine. If not, use a terrain, they're definitely okay. Or make a quad and scale it out as big as you need, etc. Cheers, Ryan |
| ||
yup... greatly done... thanqs guys |
| ||
I did Gyroman. Unfortunately the download is borked right now. You're welcome to try, and let me know if it works: www.moondoggieent.com/downloads/gyroman.zip Doesn't really matter though since that doesn't include code. I'll post the relevant function if you want. Basically I was using AlignToVector with MouseX and MouseY. Actually I was also using TFormVector to keep everything camera relative even though the camera rotates around. If it's working fine with picks then just do it that way. One CamerPick for this purpose shouldn't slow things down much. Still, AlignToVector is nice since there is an optional rate parameter you can use to smooth out the movement. |