3dcollision-detectioncollisiongdscript2d-3d-conversion

Height of a slope at a point's position (3D collision)?


I'm trying my best to describe it:

I've got a 3D sloped surface, and I wanna know the height(Z) it is at any given point inside of it. I have the surface's vertices' 3D positions, and the point's 2D position. How to know what should be the height it would collide with while at the surface?Example

I'm using GDScript, making a 3D/2.5D Doom-like engine in Godot's 2D engine. Flat floors and walls work perfectly, but slopes? I've tried everything I could think of for months and nothing worked.


Solution

  • This is what you would do: