A* Pathfinding Project

Walk on walls PointGraph


#1

Hello Aron, I really wish to make my character able to walk on “walls/ceillings” if a rotate an object and the player is on it, like in the game monument valley. I dont know if i have to create my own rotation script or where should i start because right now if a rotate my character to 90 degrees it will stop moving.
sorry for my english is not my native language and sorry for my lack of knowledge in unity.
Thank you in advance.


#2

Hey,

What you’re trying to do is definitely not an out of the box solution. Looking at some videos of Monument Valley, I would approach this with a custom movement script. Or the AiLerp maybe. I’d focus on having the character just follow the path ignoring if the floor is beneath, left right or above the player. Then have a second system take care of character orientation.

Wolf


#3

Thx mate, I will try with AILerp and the second system taking care of the char orientation.


#4

Writing a custom movement script or possibly the AILerp script is the way to go.
There is a beta version that supports pathfinding on curved worlds, but I don’t think that will work in your case as the change from wall to floor is 90 degree switch which that code was not built for. It is intended for cases like pathfinding on a spherical planet or similar.


#5

Right now I’m trying with the AILerp and a secondary script to manage the orientation but idk how to make the character to turn the direction it will move specially if its orientation has already change. Btw thanks for the replay


#6

There is most likely a better way to do this, but I’m in a train, and can’t try out anything / find you some nice example.

You are able to combine quaternions using the * operator. This means you should be able to combine rotation from the AiLerp and the CustomFloorRotation.

Quaternion CustomFloorRotation;
Quaternion MovementRotation = Quaternion.LookAt(AILerp.velocity);

Quaternion CombinedRotation = CustomFloorRotation * MovementRotation;

Something like this could work for you. If you haven’t found a solution by tomorrow I’ll do some prototype and try it out at home.

Wolf


#7

I’m unfamiliar with the Quaternions but I have read somethings about them, I will try to use them like u said and try a few things. Btw I made the character rotate with the object by making the character son of the “floor” idk if this is useful for u but I thought u would like to know it .