PhysiJS 2.0 / Goblin Physics - findSupportPoint - Cannot read property "x" of undefined error when angular_factor and velocity_factor is set to 0
Andrews54757 opened this issue · 4 comments
Using the 2.0 branch, I found this error:
Upon researching why this error happened, I found out that it happens when an object collides with another when the object is "frozen" with angular_factor
and linear_factor
.
Internally, this error is caused by the direction argument in the findSupportPoint function with the value of Vector3 {x: NaN, y: NaN, z: NaN}
. The function is called in the addPoint
function and passes next_direction
to findSupportPoint()
. The direction is NaN because the positions of the objects become NaN in goblin.
Thanks for digging into what triggers it! Do you have a simple setup to reproduce this?
Yes, I do have a setup:
https://andrews54757.github.io/PhysiJS2-Test/error.html
Code is visible here:
Sorry for the delay looking into this. Thank you for all the initial info, and that simple test case!
You've over-constrained the system, and the NaN
is it blowing up in response :)
Instead of restricting the box's movements along all 6 degrees of freedom (setting all factors to 0
), set its mass to Infinity
. The engine looks specifically for this mass and treats those objects differently.
Thanks for your help! That seems to work!