Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A possible typo and undefined attributes - reportConstraints function #16

Open
Andrews54757 opened this issue Aug 1, 2018 · 0 comments

Comments

@Andrews54757
Copy link

Hello!

Ive been looking through your nice library and I found some puzzling things about the reportConstraints function.

1. Typo

It seems like there might be a typo here where .lenght should be .length

index = _constraints.lenght;

It also seems as if it was not fixed for quite a while.

2. .ta attribute is defined conditionally

The .ta attribute is set in the addConstraint function for the slider, conetwist, and dof types.

constraint.ta = transforma;
constraint.tb = transformb;

The .ta attribute is only used in the reportConstraints function for ALL constraints regardless of type.

while (index--) {
if (_constraints[index]) {
var _constraint = _constraints[index];
var offset_body = _constraint.a;
var transform = _constraint.ta;
var origin = transform.getOrigin();
// add values to report
offset = 1 + i++ * CONSTRAINTREPORT_ITEMSIZE;
constraintreport[offset] = index;
constraintreport[offset + 1] = offset_body.id;
constraintreport[offset + 2] = origin.x;
constraintreport[offset + 3] = origin.y;
constraintreport[offset + 4] = origin.z;
constraintreport[offset + 5] = _constraint.getBreakingImpulseThreshold();
}
}

Therefore, if you create a constraint that does not set the .ta attribute, you will get an error when this function is run:

screen shot 2018-07-31 at 11 52 10 pm

@Andrews54757 Andrews54757 changed the title A possible typo A possible typo and undefined attributes - reportConstraints function Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant