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

How can I make the bottom side of the player face a position?

Asked by 5 years ago
Edited 5 years ago

So I'm making the player face the planet that they are on, but I think the facing part is too literal because they are flat down on their face on the ground. How can I make a different side of them face the ground? The bottom side more specifically.

player.HumanoidRootPart.CFrame = CFrame.new(player.HumanoidRootPart.Position, planet.Position);
0
player.Character.HumanoidRootPart.CFrame.y DeceptiveCaster 3761 — 5y
0
Can you give me the context of how I woud use that? I'm pretty sure Y is actually the one rotation that won't be affected by spherical gravity. bludud1234 40 — 5y
0
is this whats happening? https://imgur.com/a/8SIOuJt fanofpixels 718 — 5y
0
Sort of, except that I want the player straight up instead of facedown, the models that you posted were facing in weird directions. https://imgur.com/a/9fXciLT bludud1234 40 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
player.HumanoidRootPart.CFrame = 
CFrame.new(player.HumanoidRootPart.Position, planet.Position) * CFrame.fromEulerAngles(math.deg(-90),0,0);

offsetting the rotation should help

0
Multiplying it by an offset seems to be what I need, but for some reason it's giving this error: attempt to call field 'fromEulerAngles' (a nil value) bludud1234 40 — 5y
0
fromEulerAngles just needed an XYZ at the end of it. But now the player seems to be somewhat upright but it jittering like crazy. bludud1234 40 — 5y
0
oh yeah i forgot the "XYZ", maybe its that the player is trying to correct itself back to standing upright? fanofpixels 718 — 5y
0
Okay, I finally got it working pretty well. Using a BodyGyro instead of directly setting the player's rotation stops the flickering, and deg should have been rad. player.HumanoidRootPart.BodyGyro.CFrame = CFrame.new(player.HumanoidRootPart.Position, planet.Position) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0); bludud1234 40 — 5y
0
glad you got it working fanofpixels 718 — 5y
Ad

Answer this question