Legacy Collision Fails when TerrainBlock is positioned with negative Z
by Jeremiah Fulbright · in Torque Game Engine Advanced · 04/29/2009 (7:55 pm) · 4 replies
Topic says it all actually.
After some initial testing, it seems that if a TerrainBlock is positioned below 0, it can lead to collision failing.
The box.maxExtents.z < -TerrainThickness is the culprit, as when the TerrainBlock is below 0, the maxExtents is also coming back lower than the thickness, which is causing it to fail.
The easy fix is to just remove the first portion of the check, but maybe it just needs to be modified to handle position differently
After some initial testing, it seems that if a TerrainBlock is positioned below 0, it can lead to collision failing.
if (box.maxExtents.z < -TerrainThickness || box.minExtents.z > fixedToFloat(gridMap[BlockShift]->maxHeight))
return;The box.maxExtents.z < -TerrainThickness is the culprit, as when the TerrainBlock is below 0, the maxExtents is also coming back lower than the thickness, which is causing it to fail.
The easy fix is to just remove the first portion of the check, but maybe it just needs to be modified to handle position differently
#2
04/29/2009 (9:16 pm)
Nope, it would be that check that is to blame and yes, I suppose really high values would also cause it to fail, as you said.
#3
It'd probably be a fairly in depth process to actually find all of the places where that assumption is made and resolve them. I think it's explicitly made in a couple dozen places, and I have no idea where it'd be implicit.
05/04/2009 (1:40 pm)
The terrain has a lot of places where it assumes that it's z position will only scale from 0 to the maximum height in the heightmap. If you disable tiling so you can move the terrain around and fiddle with the height scale you can easily violate those assumptions, unfortunately. Both features were added after terrain had been written and I don't think these assumptions had been noticed at that time.It'd probably be a fairly in depth process to actually find all of the places where that assumption is made and resolve them. I think it's explicitly made in a couple dozen places, and I have no idea where it'd be implicit.
#4
05/04/2009 (2:56 pm)
I found 2 places like what I posted above and disabled those, and so far no other issues, but keeping my eye out
Torque 3D Owner Caylo Gypsyblood