How to get position of where player character is standing on

Hello Devforum members,

What i want to achieve is to get the position of where the player is standing in so i can spawn a model on it with PivotTo, but the issue is, how do i get the position of where the player is standing on? What I’m talking about is in this photo;

I’m trying to get the position drawn in purple but i don’t quite know how

I’ve searched all over the devforum and the closest i got is How to get what part player is standing on, and youtube videos didn’t quite have what i needed.

Any help or direction on where to go for this problem is appreciated

2 Likes

Try using raycasts! (Intro to Raycasting)

local primaryPart = game.Players.LocalPlayer.Character.PrimaryPart
local params = RaycastParams.new()
params.FilterDescendantsInstances = {primaryPart.Parent}
params.FilterType = Enum.RaycastFilterType.Blacklist
local ray = workspace:Raycast(primaryPart.Position, Vector3.new(0, -10, 0), params)
if ray and ray.Position then
    print("Floor: ", ray.Position)
end
5 Likes

excuse the necropost, but there’s a better way to do this than raycasting for some applications. If you just want the origin and not the position on the floor you can do the following:

local hrp = Script.Parent.HumanoidRootPart
local footpos = Vector3.new(hrp.Position.X, hrp.Position.Y - human.HipHeight - (hrp.Size.Y / 2), hrp.Position.Z) 
6 Likes