FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Camera strafe

3 posters

Go down

Camera strafe Empty Camera strafe

Post  _-MADMAN-_ Wed May 27, 2009 5:37 am

How Can I get camera strafe directions? I have tried this:

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

Back to top Go down

Camera strafe Empty Re: Camera strafe

Post  sio2interactive Wed May 27, 2009 5:39 am

Calculate the cross product of the direction vector of the camera and the up vector...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Camera strafe Empty Re: Camera strafe

Post  _-MADMAN-_ Wed May 27, 2009 8:56 am

Works perfectly:

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

Back to top Go down

Camera strafe Empty Re: Camera strafe

Post  swebal Thu Oct 08, 2009 9:14 am

Thanks for that!

swebal

Posts : 5
Join date : 2009-10-08

Back to top Go down

Camera strafe Empty Re: Camera strafe

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum