What does btTransform::setIdentity() do?
I had some code that wasn't generating any collision pairs, and after doing a little digging around, I realized the btTransform I was passing to my custom MotionState hadn't called setIdentity(). After calling it everything works fine, but why?
If there is some 3D math term I can Google, just let me know what the term is, because I wasn't finding much with my combinations of 'identity'.
When making a btTransform, why is setIdentity() necessary?
-
- Posts: 36
- Joined: Sun Feb 10, 2013 6:52 pm
-
- Posts: 171
- Joined: Sun Jan 17, 2010 4:47 am
Re: When making a btTransform, why is setIdentity() necessar
"SetIdentity" really just sets a safe default value for each of the data members, usually (0,0,0) on a Vector3, or (0,0,0,1) on a quaternion. Without calling it the data members in the transform can have any value. Imo, SetIdentity() should be called in the constructor.
-
- Posts: 36
- Joined: Sun Feb 10, 2013 6:52 pm
Re: When making a btTransform, why is setIdentity() necessar
Ah thanks! Makes sense... just weird that there must be a situation where default initializing the values of a transform are somehow too expensive to do automatically in the constructor.Mako_energy02 wrote:"SetIdentity" really just sets a safe default value for each of the data members, usually (0,0,0) on a Vector3, or (0,0,0,1) on a quaternion. Without calling it the data members in the transform can have any value. Imo, SetIdentity() should be called in the constructor.
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: When making a btTransform, why is setIdentity() necessar
Probably when you initialize long arrays or containers (e.g. 10000 or more elements) at once...Jonathan wrote: just weird that there must be a situation where default initializing the values of a transform are somehow too expensive to do automatically in the constructor.
-
- Posts: 18
- Joined: Wed May 22, 2013 1:45 pm
Re: When making a btTransform, why is setIdentity() necessar
Well that's not entirely correct. Setting the identity for a transform is setting the rotation matrix (basis) equal to the identity matrix, you can google that, and setting the origin to zero. This represents no rotation and no displacement. Transforming a vector using the identity transform will give you that vector back.Mako_energy02 wrote:"SetIdentity" really just sets a safe default value for each of the data members, usually (0,0,0) on a Vector3, or (0,0,0,1) on a quaternion. Without calling it the data members in the transform can have any value. Imo, SetIdentity() should be called in the constructor.