You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add a physics collider for Rapier, but I have no idea how could I parse the heights from the generated terrain.
Rapier expects it as described:
"A 3D heightfield collider can be created with ColliderDesc.heightfield(heights, scale) where heights is a matrix indicating the altitude of each subdivision point of that heightfield. The number of rows of that matrix is the number of subdivision along the X axis, and the number of columns is the number of subdivision along the Z axis. The scale argument indicates the size of the rectangle of the X-Z plane."
Have anyone tackled this before?
The text was updated successfully, but these errors were encountered:
Hi there, I haven't used Rapier before but for the heights you are probably looking for something like THREE.Terrain.toArray2D(terrainScene.children[0].geometry.attributes.position.array) (where terrainScene.children[0] is your terrain mesh). From context I'm not entirely sure what the scale argument is supposed to be, but it is probably related to the xSize/ySize options you pass to THREE.Terrain().
Hello and thanks for this amazing library!
I want to add a physics collider for Rapier, but I have no idea how could I parse the
heights
from the generated terrain.Rapier expects it as described:
"A 3D heightfield collider can be created with
ColliderDesc.heightfield(heights, scale)
whereheights
is a matrix indicating the altitude of each subdivision point of that heightfield. The number of rows of that matrix is the number of subdivision along theX
axis, and the number of columns is the number of subdivision along theZ
axis. Thescale
argument indicates the size of the rectangle of theX-Z
plane."Have anyone tackled this before?
The text was updated successfully, but these errors were encountered: