I want to make an interactive bed, by allowing the player to sleep on it. But do I use animations or do I move the player's torso?
If I move the player's torso and position the player I want them to, how would I do that?
Thanks, -flor
I want to make an interactive bed, by allowing the player to sleep on it. But do I use animations or do I move the player's torso?
If I move the player's torso and position the player I want them to, how would I do that?
Thanks, -flor
I would use an animation (or animations).
Create an animation while the HumanoidRootPart is anchored next to the bed at a specific point, and tailor the animation so the rest of the character's limbs move independently of the HumanoidRootPart, and seem to climb into the bed and lay down.
In-game, when a player decides to get in the bed, call Character.Humanoid:MoveTo(anchorPoint), whereanchorPoint is a Vector3 representing the position where your HumanoidRootPart should be anchored at during the animation. (You will also want to override character controls for this, so it's like the character is essentially entering a "cutscene").
Wait until the character is close enough to the anchorPoint, then anchor the HumanoidRootPart, set its CFrame to exactly where it was relative to the bed when you created the animation, and play the animation.
For bonus points, change the camera type or position when the animation plays, so it creates a polished "cutscene-like" effect.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
If you were to move something, you wouldn't move the torso as that would kill them.
You can rotate the torso by rotating the C0 or C1 of the RootJoint inside the HumanoidRootPart, but it would probably be better to just play a lying down animation.