I can’t think of a way to do this and it’s important for my wall jumping system.
Maybe create multiple parts for each side and check if they are touched.
While it would work, probably not the most efficient way. I’ll consider it though if no one else knows a better way,
You could also check which way the players facing when jumping onto the wall
Yeah, but couldn’t that lead to getting teleported to the other side of the wall just by jumping backwards?
Probably maybe check if the players on one side of the wall or on the other side by position like check which position is the player closest at?
How would I go about getting the position of a face of the wall?
Possibly create offsets off of the wall and check the magnitude (distance) between each offset and you would be able to check which side they are closest on / which side they jump on
You should use raycasts for this. That’ll give you the hit contact point and surface normal.
I’m not too experienced with raycasts. I’ll have to look into this. Also, wouldn’t this require me to create 4 rays that shoot in all directions?
How would the offsets be created? Create parts via a script that go to each side of the wall?
Not necessarily, but it depends on your use case. For wall jumping casting a ray at the characters origin in the direction the character is facing is usually enough.
Use Vector3:Dot()
on the look vector:
script.Parent.Touched:Connect(function(hit)
local isFacingForward = (hit.Position-script.Parent.Position):Dot(script.Parent.CFrame.LookVector)>0
end)