Change orientation of a npc when he climb stairs

Hello, I have a spider npc that can climb slope.
I want it to orientate that he can climb slope easly.
How I can do that?
Here is a video of the problem :

5 Likes

you are using pathfindingservice right?

1 Like

Yeah I’m using pathfinding. I used a pathfinding link to make the spider reach the stairs.

1 Like

It doesn’t look like we have enough information on how you want to do it. It boils down to the use of constraints as a wide answer. Or you change the structure of that stairs into a slope.

2 Likes

There is already a slope on the stairs.

since it looks like its not heading for the door, you could place invisible walls that the spider can collide with in order to force the pathfinding AI to generate a strict path toward the door. these invisible walls extend from the visible ones in order to prevent the spider being able to touch either wall. hope this makes sense but please tell me if you dont understand

The problem is not here. Actually, I didn’t put the destination on the door. The problem is that on the stairs, the spider is not climbing the stairs correctly.
I want that the spider is orientated when he climb the stairs

where is the destination? if you place the destination as the door the spider will be oriented toward the the stairs.

The destination is in front of the door

where the F indicator is? i think the spider isnt climbing the stairs as it has reached it’s destination (in front of the stairs) you wanted the spider to climb the stairs right? because if so then i suggest putting the destination behind the doors. this will cause him to orient himself toward the stairs because it is trying to reach it’s destination

1 Like

The f indicator is the destination. Sorry if you didn’t understand my problem but my problem is that I want my spider like that when he climb stairs :


Not like that :

1 Like

What Is the door just to know. It is the pillar ?

Because in fact, I have no doors. I have an elevator at the end.

ohhhhhh ok well, I can only think of 3 ways.

first, you could change the spider’s X orientation when it touches the stairs to the orientation you want the spider to be and then change it back when it reaches the top of the stairs.

secondly, you could use CFrame.lookAt to orient the spider toward a certain point when it tries to climb the stairs ( which will be above the top stair causing the spider to turn like in the example)

lastly, you could tween the spider when it touches the first step and make it walk at that orientation up the stairs and the same way up the last set of stairs. basically just animate the entire process.

1 Like

my bad i thought they were doors. i meant the elevator

I think I will try the second way. I will put a part at the top of the stairs that the spider will look at.

1 Like

It worked but partially due of pathfinding.
I think I need use tween service when the spider go upstairs


Just I will go sleep. Its midnight for me

1 Like

That worked perfectly using tween service.
I used one pathfinding to the bottom of the stairs, then I used 3 tween for a smooth animation, then another small pathfinding to the elevator (I could use tween for that).
Don’t worry about the teleportation on the video, its because I cheesed It

1 Like

it seems that the spider keeps getting stuck in the walls and on the stairs try making the spider collision of with a certain script

nvm you already fixed it so ill not change anything up :laughing: