Hi Yal, thanks for making this. I know it's "old" but it really helped me in my learning journey with using 3D in Game Maker.
If possible I need a little help with something: I'm trying to make it so the sprite that generates "slopes/ramps" can have any image_angle value and still work as a ramp from that direction.
I have the code to create vertex buffers for the slope at any angle so that aspect works fine and generated 3D model is nicely rotated. But I can't figure out how I can use this so the collision with ramp works properly at any angle.
This is your code for ramp collision that should return player's z position on the ramp:
function func_CollisionTopSlanted(xx, yy) { hlerpT = clamp(lerp(z_tlc, z_trc, xx / sprite_width), min(z_tlc, z_trc), max(z_tlc, z_trc)); hlerpB = clamp(lerp(z_blc, z_brc, xx / sprite_width), min(z_blc, z_brc), max(z_blc, z_brc)); bilerp = clamp(lerp(hlerpT, hlerpB, yy / sprite_height), min(hlerpT, hlerpB), max(hlerpT,hlerpB)); return bilerp; }
And as it is it works great for "non-rotated" ramps (image_angle is 0).
I figured I should probably replace "xx / sprite_width" and "yy / sprite_height" with something that takes into account the rotation of the sprite that generates slope but am not sure. Any help, hints or tips are greatly appreciated!
Thank you!