Camera strafe
3 posters
Camera strafe
How Can I get camera strafe directions? I have tried this:
Works weel until I rotate the camera - bslide doesn't update, it's always the same world direction. Also tried to flip x with y with no succes (bugs between 0-90-180-360 angles).
Any advice will be great!
Regards,
Mad
- Code:
btVector3 bslide (sio2->_SIO2camera->_SIO2transform->dir->x*90.0f, sio2->_SIO2camera->_SIO2transform->dir->y, sio2->_SIO2camera->_SIO2transform->dir->z);
Works weel until I rotate the camera - bslide doesn't update, it's always the same world direction. Also tried to flip x with y with no succes (bugs between 0-90-180-360 angles).
Any advice will be great!
Regards,
Mad
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: Camera strafe
Calculate the cross product of the direction vector of the camera and the up vector...
Re: Camera strafe
Works perfectly:
Thank You!
- Code:
btVector3 bforward (sio2->_SIO2camera->_SIO2transform->dir->x,
sio2->_SIO2camera->_SIO2transform->dir->y,
sio2->_SIO2camera->_SIO2transform->dir->z);
btVector3 bside (0.0,
0.0,
1.0);
btVector3 bslide = cross(bforward, bside);
Thank You!
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Permissions in this forum:
You cannot reply to topics in this forum