The point that indicates the position of a 3d model at its transform?

I’m having difficulties with making a side-scroller game, because i need to know where the point that represents the location of a platform is in the world, like whats the distance between the transform’s position point and the mesh’s edge. I need this information to calculate the position my character should land on ramps when falling or when jumping. I can’t use any mesh collider because he floats above the platform itself. More specifically, I’d like to know how to get that difference in the X axis.

Hey gamerphysics,

I’m not entirely sure what you’re asking for assistance with, but it sounds like the issue you’re facing is with collision detection(?)

There are a couple of ways in which you could resolve this:

If you are using rigidbodies, then you don’t have to worry about that, and the collisions will be handled innately. (Moving objects would have a rigidbody + collider, and the platforms would just have one collider)

If you don’t want to use rigidbodies, for whatever reason, then you could always use raycasting to determine the distance between the two colliders. (With added handling for the distance you would like the character to stop)

Hope that helps.

Regards,
Ezro

First, thanks for having replied!

But, it’s not that what I was asking about. I have the platform and a ball (that is the player) hovering above it, when it jumps and lands on top of a ramp, its hovering height gets distorted, but I’ve found a way to fix this by calculating what should be its Y position based in its X distance from the beginning of the ramp, but the thing is I don’t know where the edge of that ramp mesh is in the world, and I’d like to know how to discover it from the Transform’s position. Where is the Transform’s position located inside the mesh, how to get the distance it is from the edge, and only in one axis. It is because the player is hovering I can’t use colliders for making it land properly.

Thanks!

You could use colliders, and then use a Raycast to find the distance from your character to the edge of the platform.

Oh, thanks!

I didn’t know what raycasts were, I’m a real beginner yet, so I googled them, and thay are awesome! I was able to solve my problem!