An Algorithm for a Ramp in 3D

Started by
0 comments, last by Obs-D 7 months, 1 week ago

Hello there,

I'm trying to obtain the altitude of the vertical axis in a determinated point in order to place the adecuated vertical position to the creature moving up or down in the ramp.

What i have so far:

I do manage to obtain the equation of it from two points, so i have a rect parametric equation waiting for a parameter in order to return the value than should be.

The Question:

How can i connect the player position to it?

What i mean by that is than, this rect equation is a line right? a line in 3d space created at the side or at the middle of the ramp, doesn't matter where is exactly created because the thing is i can't find a way to make intersect a line generated from the character position to the ramp line besides the case the player position is just under such line.

So, how can i make it in order to make a line from the player than go just straight up and somehow get the exact altitude where it intersect with the ramp line?

Having in mind than the ramp line cannot be moved, and the character only can shot a line up considering what we are trying to achieve, the solution will be to make a parallel line to the line of the ramp than just so happend to pass over the character position, so the character can make the second line and i achieve the intersection point obtaining what i need from it.

The issue is, how can i obtain that parallel line?

If there is another approach for this, please let me know

Other attemtps already tested:

  • I manage to make an algorithm that works using linear equation instead BUT it doesn't work for diagonal cases, in the rest of the cases it's pretty much flawless.

Have a nice day!

None

This topic is closed to new replies.

Advertisement