MeshY like TerrainY?
Blitz3D Forums/Blitz3D Programming/MeshY like TerrainY?
| ||
I plan on moving npc entities around a "floor" mesh, this mesh probably will end up having elevation changes. Is there a MeshY similar to Blitz terrain's TerrainY? |
| ||
Nope. Best way would be to do a linepick straight down from your character position. |
| ||
Doing linepicks like that would kill my engine... It works fine if it's only a few of them... but I have at least thirty npcs running around. |
| ||
Only other way is to try using sliding collisions but I don't know how well that's going to work. Might be instances where an object can drop through the floor... |
| ||
You could try to calculate the position under the npc, using vertexx(), vertexy() and vertexz(). For that, find the 3 closest vertices around the npc and calculate the height using these variables. |
| ||
You could perform a step when the game loads, or outside of the game and store it as a data file, where the program performs a bunch of linepicks at regular intervals to create a grid array of heights, like a heightmap. Then you could interpolate between grid points to calculate the height of the mesh at any point. As long as you use a fine enough resolution of your grid it would work, and should be almost as fast as terrainy - which is really just a calculation based on the heightmap in a similar fashion. |