On W pressed, the player moves to the tile in front of them, however, the player seems to clip into the new tile when moving them to the next tile.
player.Character.HumanoidRootPart.CFrame = CFrame.new(RayResult.Instance.Position + Vector3.new(0, player.Character.Humanoid.HipHeight, 0))
November 28, 2021, 10:33pm
I think u gotta add a small offset so the player doesn’t get CFramed into the part as much, maybe a stud or two higher would resolve your issue.
If you read my OP, you would have noticed I tried to offset the value using
Humanoid.HipHeight. The result is as shown in the video.
I’d prefer if the offset used is the exact value of the HumanoidRootPart from the ground.
November 28, 2021, 10:37pm
You can use TweenService to move the character CFrame to the desired CFrame.
Never mind, I literally just solved my own problem with my reply.
I simply added the y value of my HumanoidRootPart.Position to the new tile position and it works perfectly fine.
player.Character.HumanoidRootPart.CFrame = CFrame.new(RayResult.Instance.Position + Vector3.new(0, player.Character.HumanoidRootPart.Position.Y, 0))
November 28, 2021, 10:41pm
That is entirely different from what the title or OP states. Be sure to clearly state what you need, or you will get mixed answers like the replies above.
November 28, 2021, 10:43pm
This is because you were changing HumanoidRootPart’s position, not the full Character’s one.
Also, you can use
:MoveTo(), this function will automatically position the Character on top of the part at the exact height without having to use Humanoid’s HipHeight.
No this is
exactly what I stated in my original post.
Please read properly before commenting next time.
Definitely more elegant than my solution, thank you.
November 29, 2021, 7:41am
Alternatively you can use SetPrimaryPartCFrame() or PivotTo() which will both retain the original orientation of the character model, MoveTo changes a model’s positional data only.