odd syntax question.

Post Reply
User avatar
teravus
Posts: 12
Joined: Sat Sep 19, 2009 12:44 pm

odd syntax question.

Post by teravus »

I was just noting that some of the code in the constraints have 'odd' syntax.

For example;

getRigidBodyA().getCenterOfMassTransform().getBasis() * m_rbAFrame.getBasis().getColumn(2);

If I were to look at this linearly, I would 'think' it's setting the origin of rigidbodyA's center of mass transform to it's basis times the 2nd column of the frame of rigidbodyA.

Vector3 RigidBodyA.CenterOfMass.Origin = RigidBodyA.CenterOfMass.Basis * the 2nd row of basis of the frame rigidbodyA.

Is this correct? It doesn't have an assignment operator, so I have to assume it's doing an operation on a pointer.

(it's in src/BulletDynamics/ConstraintSolver/HingeConstraint.cpp line 225)

Suspiciously, it's also part of an assignment 3 lines down.

Code: Select all

getRigidBodyA().getCenterOfMassTransform().getBasis() * m_rbAFrame.getBasis().getColumn(2);
btVector3 jointAxis0 = getRigidBodyA().getCenterOfMassTransform().getBasis() * jointAxis0local;
btVector3 jointAxis1 = getRigidBodyA().getCenterOfMassTransform().getBasis() * jointAxis1local;
btVector3 hingeAxisWorld = getRigidBodyA().getCenterOfMassTransform().getBasis() *  m_rbAFrame.getBasis().getColumn(2);
			
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: odd syntax question.

Post by Erwin Coumans »

Good find, it is a copy/paste bug, doing a no-operation indeed. Note that it is in the obsolete implementation, but it should be fixed nevertheless.

Thanks for the report!
Erwin
Post Reply