TheGameCreators / GameGuruRepo

The GameGuru Repository For Community Collaboration
http://www.game-guru.com
137 stars 56 forks source link

RayTerrain() detection returning wrong position for trees via GetRayCollisionX(), GetRayCollisionY(), GetRayCollisionZ() #4992

Open TenebreGaming opened 11 months ago

TenebreGaming commented 11 months ago

The position of normal terrain is correct, but the position is not correct when a tree is detected.

Edit: I have also found that the trees are causing false collisions with the IntersectAll() function when the trees are nearby (and not even near the path of the ray). I was encountering some weird errors in some areas and found that these areas all had trees near them. Removing the trees removed the errors.

AmenMoses commented 11 months ago

Don't know if it is related but the AddObjectCollisionCheck doesn't work for the new trees either.

The cause in this case is probably due to object Id ranges having been added/changed as the physics object collision checking uses object Ids to correlate Bullet collision events with specific types of object, when I added it it only knew about terrain and ordinary physics objects. I suspect some other kinds of physics objects have been added (like procedural trees) which report as different object Id ranges and that is confusing the system.

LeeBamberTGC commented 10 months ago

@TenebreGaming In the new procedural terrain system this command only works now when the ray points straight down as that is how the new engine uses it. I have updated the global.lua notes to this effect, and retagged this as a feature request to expand the LUA command to allow a raycast in any direction. For now, use the IntersectAll command instead.

RayTerrain: r=RayTerrain(x,y,z,x2,y2,z2) -- returns 1 if the ray cast hits the terrain geometry (only reliable when ray faces directly down)