Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

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)

2 comments

0

-1 for atrocious code

0

-1 for unreadable code as well

This discussion is preserved as it was. New answers, comments, and votes are closed.