Rotated terrain cannot be picked

Hi,



just wanted to add that picking the terrain does not work after using .setLocalRotation() or .rotate() on the TerrainQuad.

CollisionResults is always empty after picking the terrain geometry. If I comment out the rotation, it works again.

correct. Terrain is essentially axis aligned with y-up

I should have setLocalRotation throw a warning.

Yeah, but I rotate only around the y-axis, so it still lies in the xz-plane.





[java]terrain.setLocalRotation(new Quaternion().fromAngles(0, (float) Math.PI, 0));

[/java]

It is still axis-aligned on the xz plane as well. Many operations, picking, collision, height adjustment, would have to be changed to support the rotation, and as a result there would be large performance losses because it is no longer axis aligned.

Aligning it on all axes is strictly for performance.

Sorry :slight_smile:

Ok, got that :slight_smile:

Isnt it possible to apply reverse transformation on picking ray and forward one on result and keep it axis aligned?



If yes, then it imo should be done by terrain itself, even though user can do it too (assuming it works at all), because hard work should be IN library.

yes that should be possible. It will still affect performance, although not greatly. There isn’t enough of a demand for the terrain to be rotated to implement it at the moment. However if someone submitted a patch I would consider adding it.