Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Alligning character to the wall side ways using CFrame?

Asked by
n_ubo 29
2 years ago

So I'm making a parkour game and before this issue, I've made the character successfully face the wall when it wants to scale the wall.

Anyway, that was for climbing, right now I'm making the second part allowing the player to wall-run which also works fine, the only thing I want to add is to make the character face the wall it's running, but sideways. this works for walls that are rotated -45 degrees, but not on walls in other directions. I'm trying to make this dynamic and I've tried several things.

CFrame_Line:

                    CFrame.new(
                        hrp.CFrame.p
                        ,Vector3.new(hrp.Orientation.X
                        , wallpart.Orientation.Y - rightcastresult.Normal.Y
                        , hrp.Orientation.Z
                        )
                    )

I've tried adding 90 degrees to the CFrame like

Cframe_Line*CFrame.Angles(0,math.deg(90),0)
--or
Cframe_Line*CFrame.Angles(0,math.rad(90),0)

I've tried using RightVector

CFrame.New(Cframe_Line.Position, Cframe_Line.RightVector)

but none proved any different.

right now I have footage of it working on 1 type of wall in a particular direction, and also not working on other wall directions:

youtube wallrun issue

Here's how the raycast works and how I want it to work the raycast is set up fine.

raycast lines

1 answer

Log in to vote
1
Answered by
fcvrs 22
2 years ago
Edited 2 years ago

I think you might be overthinking this. Couldn't you just set .Orientation to the same as the wall? (You'd also need to make sure the front of the wall is orientated correctly)

0
yes, was able to fix this with front facing walls, did had to make invisible wall parts but i managed to automatically generate those over buildings, still am trying to make this dynamic without invisible parts n_ubo 29 — 2y
Ad

Answer this question