
get a vector from quaternion
-
- Posts: 11
- Joined: Wed Jun 29, 2011 3:49 pm
get a vector from quaternion
Hello all, I need to be able to get a btVector3 from a btQuaternion. I have no clue how to do this conversion? 

-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: get a vector from quaternion
Did you check out the API? That would be the first place to look. If you want the rotation axis:
http://bulletphysics.com/Bullet/BulletF ... 98e73140c3
http://bulletphysics.com/Bullet/BulletF ... 98e73140c3
Code: Select all
btQuaternion quat = ...;
btVector3 rotAxis = quat.getAxis();
-
- Posts: 11
- Joined: Wed Jun 29, 2011 3:49 pm
Re: get a vector from quaternion
yep, looked all through the API. I tried the rotation axis, but it doesn't work :/ Also, is there a way to get the individual x,y,z,w values from a btQuaternion?
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: get a vector from quaternion
Doesn't work? What do you mean? Is it (0,0,0)? In which case the quaternion probably wasn't defined right.
You can get the w component via quaternion->getW()
You can get the w component via quaternion->getW()
-
- Posts: 171
- Joined: Sun Jan 17, 2010 4:47 am
Re: get a vector from quaternion
One thing you really need to keep in mind when looking at the Bullet API doc's is that they don't show inherited members from base classes. So you really aren't seeing the full list of what the class can do if it inherits from anything. Be sure to look at any base classes as well to verify if the class has what you are looking for or not.
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: get a vector from quaternion
Good point, I occasionally forget that myself. Indeed, it seems btQuaternion inherits from btQuadWord, which has accessors for x/y/z/w, in x() and getX() formats (though for some reason getW(), specifically, is in btQuaternion and not btQuadWord...).Mako_energy02 wrote:One thing you really need to keep in mind when looking at the Bullet API doc's is that they don't show inherited members from base classes. So you really aren't seeing the full list of what the class can do if it inherits from anything. Be sure to look at any base classes as well to verify if the class has what you are looking for or not.