I asked a question in the past that attacked my current problem from another direction and here's a link if you'd like to check it out. Several people have suggested things like using a BodyGyro
(didn't work) or setting the HumanoidStateType
of the Humanoid
to Physics
(also didn't work). It has been made known to me that this problem is due to the fact that the Humanoid is trying to "get up" or something like that. I'm not sure what that means, but if there's a way to prevent that without going through all the hassle of coming up with a different way to orient the player, that would be nice.
If you're wondering why the two suggestions didn't work, you can read this paragraph, if not, feel free to skip past. BodyGyro
just didn't work. Apparently it only rotates the player to face a direction, not actually do things like point them upside down (you can read my previous question for more description of the intended behavior). Setting the HumanoidStateType
to Physics
also didn't work for similar reasons to why setting the PlatformStand
property to true
didn't work. Collisions are a big issue (cause they result in uncontrolled violent motion in random directions) and, when a BodyVelocity
is used to apply force to the player, the player won't stop moving when the applied force is stopped. The continued momentum might be able to be easily fixed (I haven't tried), but considering the fact that I don't have a clue how to fix collisions, I've dropped this as an option for now.
My new idea, which was found by looking through the code of another person, is to change the rotation of a joint (at least, I think that's what I would be doing). Here's the code they used:
lua
chr.LowerTorso.Root.C1 = chr.LowerTorso.Root.C1 * CFrame.Angles(math.rad(90), 0 ,0)
With this in mind, I looked to modify my old code:
lua
local direction = camera.CFrame.LookVector
local position = root_part.Position
root_part.CFrame = CFrame.new(position, position + direction)*CFrame.Angles(math.pi/2, math.pi, math.pi)
to use the joint instead:
lua
local some_cframe = CFrame.new(position, position + direction)*CFrame.Angles(math.pi/2, math.pi, math.pi)
lower_torso.Root.C1 = lower_torso.Root.C1*some_cframe
but this just resulted in the character disappearing and I'm sure it's not even close to functioning. I'm not sure, but I think I at least have a way to restore the player to normal behavior by saving the default rotation in a variable:
lua
local default_joint_c1 = lower_torso.Root.C1
Either way, I don't know how to modify the CFrame.Angles
so that it takes into account the angle that my camera is looking in.
I'd appreciate any advice/suggestions/alternative solutions. You can look at my other question for more details and feel free to post questions/comments below. Thanks!