Question About Different Gravities on Any Surfaces

Hi, I’m about to create a game that characters might walk on different surfaces with different gravities.
(Here is a demonstration of the level’s gravity Add A Gravity Gun For Fun In My New FPS Framework - YouTube
)
So I also need
1, mobs can walk on the surfaces
2, mobs might change gravity at runtime
3, mobs can walk from one surface to another.
4, mobs can walk on a sphere

I’ve tried AIPath with a custom gravity, AIPath by default will behave weird if gravity is not pointing downward in world space after run, but will be fine after the first path finding move. Also, if I change the gravity of AIPath, it doesn’t change the rotation keep character up direction correctly by the gravity.

RichAI doesn’t work at all, the character up direction is always Vector3.up of world space.

AIPath and RichAI weird behaviors are in the link

And I haven’t seen any documents talk deeper about gravities, so if I have such need, should I make my own agent class to move the mob?

Another thing is that if I want connected pathfinding results between surfaces and sphereical pathfinding, should I make a custom Graph to scan the level?

Some follow up.

I’ve tried to implement an agent with KinematicCharacterController, the A* Pathfinding doesn’t support workflow of KCC very good (KCC needs velocity and input instead of direct movement), but it still looks okay. I use NodeLink at the edge of different Grid Graph surface.
I also tried custom Graph, but the tutorials are made with PointNode which is a little weird when agent walks on. I still need to look deeper into how to make a solid spherical Graph.

Hi

The beta version has partial support for this. In this case, since you are using a grid graph, you might want to use the AIPathAlignedToSurface script.

See the beta docs: Spherical Worlds - A* Pathfinding Project

1 Like

Thanks ,you’re so genius. I just tested the beta version of 4.3.19.
And the AI can walk on the surface if the graph is rotated. Works good!

1 Like

Well…there’s just one more thing that I’ve notice the agent can’t walk across surface with LinkNode if equal or over 90 degrees. It will fall into oblivion lol.

Hi

Yes, the agent uses a raycast to figure out the angle of ground below it. A 90 degree wall will be completely missed by that. This is one of the reasons the doc page linked above prefers smoother transitions than 90 degrees.
If you want 90 degree corners then this is unfortunately not handled by the AIAlignedToSurface script, you will need to make some modifications/write your own.

1 Like

Thanks ,now I know that.