How to maintain constant height above the mesh? (FloatingPawnMovement)

I’m experimenting with floating movement for the first time.
The pawn finds paths above the navigation mesh. It is okay.
The problem is when it goes up ramps then it is not able to go down them.
It stays still in the air and doesn’t move anymore.
I think it is because it is too far from the mesh and does not detect it.

Is that the problem?
If so, how can I maintain a constant height above the mesh so that it always finds its way?

Thank you so much!!

you could fire a line trace from the pawn to the ground,and then set it’s location to the ground.
character movement is more convenient and has more features.

Floating pawn movement doesn’t suitable for human AI walking on complicated environment.if you use it your going to do a lot extra works…
It’s suitable when the AI walk along a spline or walk on a flatten plane or move in the air.

One of its advantages to me is when your AI has simple behavior and move on a plane,using floating pawn movement could improve performance if you want to spawn alot of them.(definitely cost less then character movement component)

1 Like

Hi @baobao4435

Your idea does work…

However my map is a little “special”…
In some places I have a navigation mesh in the air and there is no ground below it.

I’m looking for a way to make the ray detect the nav-mesh instead of the ground.
That would be perfect!!
Any ideas?

Thank you so much!!

1 Like

I remember there’s a static mesh under the navmesh in your map?
probably find a way to detect the static mesh :grin: .

1 Like

@baobao4435

Works perfect!!


Just need to optimize the code a little… :upside_down_face:

Thank you very much for your help!! :heart: :heart:

1 Like

Your welcome

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.