-
Notifications
You must be signed in to change notification settings - Fork 710
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
Heightfield issue: Make sure they are ordered CCW around the normal, using the right hand rule. #149
Comments
I've seen this error before and I'll fix it later on. For now, you could keep your height values small and move the shape up instead. |
Has this been resolved I am still having this issue. |
If this issue comes with any other cannon body then check scale value of body. for me when it was negative bcoz the object in blender was in -ve x, y &z. which caused the issue. I fixed by setting scale value to positive. |
Hello,
I give a try to CANNON.Heightfield but I meet an issue during step(). I can see the javascript console log below in red, I suspect this message below is important. Issue seen on Cannon.js 0.6.0 (git extract from a couple of days).
.faceNormals[1] = Vec3(0,0,-1) looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule. (23:54:00:901 | error)
at ConvexPolyhedron.computeNormals (www/js/libs/cannon.js:7125:21)
at Heightfield.getConvexTrianglePillar (www/js/libs/cannon.js:8437:12)
at Narrowphase.(anonymous function).Narrowphase.convexHeightfield (www/js/libs/cannon.js:10590:21)
at Narrowphase.(anonymous function).Narrowphase.boxHeightfield (www/js/libs/cannon.js:10525:10)
at Narrowphase.getContacts (www/js/libs/cannon.js:9439:34)
at World.internalStep (www/js/libs/cannon.js:11243:22)
at World.step (www/js/libs/cannon.js:11088:14)
at xxx (www/js/main.js:178:17)
.vertices[5] = Vec3(-0.25,0.75,5.5) (23:54:00:902 | warning)
at www/js/libs/cannon.js:7127
.vertices[4] = Vec3(0.75,-0.25,5.5) (23:54:00:903 | warning)
at www/js/libs/cannon.js:7127
.vertices[3] = Vec3(-0.25,-0.25,5.5) (23:54:00:903 | warning)
at www/js/libs/cannon.js:7127
Right, it seems (-0.25,0.75,5.5) (0.75,-0.25,5.5) (-0.25,-0.25,5.5) are not in CCW order (right handed). Please find my (simplified) code below:
The issue disappears if I guarantee Y heights are smaller (fix code: matrix[i][j] = i - j - 10;)
The text was updated successfully, but these errors were encountered: