favreau / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

btUniversalConstraint debug draw fails. btUniversalConstraint::calculateTransforms() call necessary? #514

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a btUniversalConstraint :
Hi,

I tried to figure out, why my "btUniversalConstraint" was not being "debug 
rendered" at the right location.

I figured out that the debug drawer relies on 
"btGeneric6DofConstraint::m_calculatedTransformA" / "m_calculatedTransformB" to 
render the constraint.

However, these "m_calculatedTransformA" values are computed from "m_frameInA" 
in btGeneric6DofConstraint::calculateTransforms().

In the case of "btUniversalConstraint", "calculateTransforms()" is being called 
in the constructor (parent btGeneric6DofConstraint constructor call), but this 
happens BEFORE "m_frameInA" / "m_frameInB" are being set, hence wrong values 
computed for "m_calculatedTransformA" / "m_calculatedTransformB".

I solved my problem by calling "calculateTransforms()" once the constraint is 
created, but is that a normal behaviour ? Isn't it a bug ?

[code]btUniversalConstraint* pUniv = imNew btUniversalConstraint(*pBodyA, 
*pBodyB, anchor, parentAxis, childAxis);
pUniv->setLowerLimit(pConstraintUniv->m_fLowerLimitAngle1, 
pConstraintUniv->m_fLowerLimitAngle2);
pUniv->setUpperLimit(pConstraintUniv->m_fUpperLimitAngle1, 
pConstraintUniv->m_fUpperLimitAngle2);
m_pDynamicWorld->addConstraint(pUniv, imTRUE);

// below the line of code necessary to have the debug drawer rendering the 
constraint correctly
//pUniv->calculateTransforms();[/code]

2. debug draw the scene
3.

What is the expected output? What do you see instead?
the constraint is not being shown at the right place

What version of the product are you using? On what operating system?
trunk head

Please provide any additional information below.

Hi,

I tried to figure out, why my "btUniversalConstraint" was not being "debug 
rendered" at the right location.

I figured out that the debug drawer relies on 
"btGeneric6DofConstraint::m_calculatedTransformA" / "m_calculatedTransformB" to 
render the constraint.

However, these "m_calculatedTransformA" values are computed from "m_frameInA" 
in btGeneric6DofConstraint::calculateTransforms().

In the case of "btUniversalConstraint", "calculateTransforms()" is being called 
in the constructor (parent btGeneric6DofConstraint constructor call), but this 
happens BEFORE "m_frameInA" / "m_frameInB" are being set, hence wrong values 
computed for "m_calculatedTransformA" / "m_calculatedTransformB".

I solved my problem by calling "calculateTransforms()" once the constraint is 
created, but is that a normal behaviour ? Isn't it a bug ?

Original issue reported on code.google.com by easyrid...@gmail.com on 10 May 2011 at 7:33

GoogleCodeExporter commented 9 years ago
see https://github.com/bulletphysics/bullet3/issues/142

Original comment by erwin.coumans on 30 Mar 2014 at 7:44