Making a player face a wall

I’m working on a wall climbing system for my game and I was wondering what is the best way to make a player forcefully face a wall? I’ve tried body gyros but I could never get it to work.

I raycast onto the wall so I can use the raycast normal / raycast position if its needed.

1 Like

Would cframe be possible in your system?

1 Like

elaborate on that if possible.

I would use cframe to make the character rotate to the wall,

CFrame.lookAt(Pos,WallPos)
– WallPos being the raycast position from character to wall

You can use lerp or tweenservice to make it smooth

1 Like

I’ve tried that but you can simply turn out of it and it looks snappy.

Probably try disabling userinput while the character rotating to face the wall then maybe to avoid the turning out of it problem, not sure by snappy you can always just use tweens to avoid that

2 Likes

How can I disable user input? (

You can use ContextActionService with its priority functions to overwrite player input

1 Like

That cannot prevent a player from using shiftlock to turn though. And I don’t want to disable shift lock either as my game relies on shiftlock.

Not sure if it can prevent shiftlock, although it is possible to edit the shiftlock code to only enable when a player not climbing a wall you have to look thru the player scripts for that

Alternatively you can make a fake character that way its 0 chance for player to have control over movement

1 Like

I want it to be able to be enabled whilst climbing though.
The issue is getting a force strong enough to prevent the body from turning at all so it stays locked onto the wall.

Body Gyros are probably the best way but I can never get them to work.

Anchor the HumanoidRootPart of the player’s character (they will still be able to rotate), if you need the camera to fixate on a wall then you should be scripting the camera instead of attempting to disable player controls.

2 Likes

I use body positions instead of anchoring the humanoidrootpart.
I’m not trying to make the camera face the wall I’m trying to make the player face the wall and be unable to turn away from it while the player is climbing

Anchor all of the parts of the character then, it really is that simple.

1 Like

That would prevent me from being able to animate the climbing. The character would be motionless and that wouldn’t look too good.

Similar to what limited said about camera manipulation I think coding your own shift lock style camera would provide much better flexibility for what your trying to do

You can use this module if you don’t want to code your own

1 Like

I dont think thats necessary. I tried setting the cframe every runservice render step and that seems to do the trick and it doesnt snap. Only issue is shift lock can override it once more. Is there anyway to disable shiftlock rotating the character temporarily?

You might be able to in playerscripts But I am not entirely sure, I know with the module I just sent you can do that

1 Like

I found a post which helped me solve this.

works smoothly now.
ty for the help.