• Công Nghệ
  • Ẩm Thực
  • Kinh Nghiệm Sống
  • Du Lịch
  • Hình Ảnh Đẹp
  • Làm Đẹp
  • Phòng Thủy
  • Xe Đẹp
  • Du Học
Hình Ảnh Đẹp

How would I make a player face the opposite direction of a wall?

12:06 20/08/2026

What do you want to achieve? Imagine Mario’s wall jump but in a 3D space. I need to rotate the player the same way as the direction of the wall they just landed on. Working correctly, it would look like this:

How I’m attempting to go about this is casting a ray from the character’s HumanoidRootPart, looking at the wall the player just touched, then using workspace:FindPartOnRay to get the surface normal of that wall, then orienting the HumanoidRootPart according to that surface normal.

What is the issue?

Click here to see a bunch of screenshots The current code does this. normalDirection is 0,0,0. The neon part is a visualization of the ray, you can see the code for it below.

normalDirection is -0.707079291, 0, 0.707134247

The ray shows a bit of deviation based on rotation, as you can see here.

The player isn’t being rotated correctly, and I’m not sure why. I think it has something to do with the ray not being cast correctly, but that wouldn’t explain why normalDirection is 0,0,0 for three of the four surfaces.

What solutions have you tried so far? I tried looking on the developer forum but I couldn’t find anything. The code I have so far is thanks to the help of a friend helping me slowly trouble shoot, but we’re both stumped. At first I tried orienting the character’s HumanoidRootPart opposite the wall, that didn’t work. I’m honestly not sure what’s going wrong here, so aside from making sure I didn’t make any typos I can’t say I’ve tried “fixing” this. As far as I’m aware, this should work.

-character.HumanoidRootPart.CFrame.p + -1*(touchedPart.CFrame.p) local ray = Ray.new(character.HumanoidRootPart.Position, CFrame.new(character.HumanoidRootPart.Position, touchedPart.Position).p.unit) local part, pointOfIntersection, normalDirection, material = workspace:FindPartOnRay(ray, player.Character) character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.CFrame.p, normalDirection) print(normalDirection) local part = Instance.new("Part") part.Parent = workspace part.CanCollide = false part.Anchored = true part.Material = Enum.Material.Neon local p1 = ray.Origin local p2 = ray.Origin + ray.Direction*500 part.Position = Vector3.new((p1.X+p2.X)/2, (p1.Y+p2.Y)/2, (p1.Z+p2.Z)/2) part.CFrame = CFrame.new(part.Position, p2) part.Size = Vector3.new(0.25, 0.25, (p1-p2). Magnitude)
  • Điều khoản sử dụng
  • Chính sách bảo mật
  • Cookies
  • RSS
  • Điều khoản sử dụng
  • Chính sách bảo mật
  • Cookies
  • RSS

Trang thông tin tổng hợp melodious

Website melodious là blog chia sẻ vui về đời sống ở nhiều chủ đề khác nhau giúp cho mọi người dễ dàng cập nhật kiến thức. Đặc biệt có tiêu điểm quan trọng cho các bạn trẻ hiện nay.

© 2026 - melodious

Kết nối với melodious

vntre
vntre
vntre
vntre
vntre
789club Sun win 789CLUB
  • Công Nghệ
  • Ẩm Thực
  • Kinh Nghiệm Sống
  • Du Lịch
  • Hình Ảnh Đẹp
  • Làm Đẹp
  • Phòng Thủy
  • Xe Đẹp
  • Du Học