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

How to get the Orientation of the Platform Beneath a Character?

Asked by 4 years ago

I'm certain this is not an easy thing to do; however, I have to ask (as it is very important to the game I'm trying to develop).

Is there any way to get the orientation/rotation of the surface a character is standing on? In short, I have scripts that fire parts straight out of a players torso, but if they are standing on an incline or something, they just go into it rather than upwards/downwards (parallel to the surface). Is there some way to do this? If so, I would greatly appreciate it!

Thanks in advance!

2 answers

Log in to vote
0
Answered by 4 years ago

You can raycast below a character to figure out what part, position, normal, and material. You can use the normal or the part's CFrame and/or Orientation properties to determine the angles and whatnot.

Here is a video on Reflecting raycasting. Although this is not what you are looking for, it provides a visualization of what the normal is and can possibly help you with your fire parts:

https://youtu.be/yKyb_wJTaDk

Good luck!

Ad
Log in to vote
-3
Answered by 4 years ago

This code will see whats the player is touching and look at its orientation

local UsingR15 = true
game.Player.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(char)
        if UsingR15 then
            char.LowerRightFeet.Touched:Connect(function(blocktouching)
                char.LowerLeftFeet:Touched:Connect(function(IDontLikeWorkingWithFeet)
                    if blocktouching == IDontLikeWorkingWithFeet then
                        print(tostring(blocktouching.Orientation))
end
end)
end)
end

else

char.['Right Leg']Touched:Connect(function(blocktouching1)
                char['Left Leg']:Touched:Connect(function(IDontLikeWorkingWithFeet1)
                    if blocktouching1 == IDontLikeWorkingWithFeet1 then
                        print(tostring(blocktouching1.Orientation))
end
end)
end)
end

end)
end)
0
-1 for atrocious code DeceptiveCaster 3761 — 4y
0
-1 for unreadable code as well programmerHere 371 — 4y

Answer this question