Roblox get character from player9/25/2023 Get the rotation of the camera (by using arc-tangent and camera's look-vector).The way we will lock the player's rotation to the camera is as follows: The HumanoidRootPart is the PrimaryPart of the character model, and thus is the part we should manipulate if we want to manipulate the model as a whole. Also, we will rotate the HumanoidRootPart instead of the Torso/UpperTorso. When the player presses the right mouse button, let's connect a function to the Heartbeat event that will update the character's rotation to the camera's. You've almost got it, but let me take a slightly different approach to my solution. Torso.CFrame = CFrame.new(Vector3.new(Torso.CFrame),Vector3.new()) If Input.UserInputType = 2 and not onGui then UIS.InputBegan:connect(function(Input,onGui) If Input.UserInputType = 2 and MB2Down then Local Torso = Character:FindFirstChild('Torso') or Character:FindFirstChild('UpperTorso') local UIS,Player,Camera,Character,MB2Down = game:GetService('UserInputService'),workspace.Camera,script.Parent,false I fixed the black screen, but the player still just dies. What's the correct way to achieve this?Įdit: My bad, this is what I have so far. I've worked with CFrames quite a bit in the past, so I'm not sure why I'm having such a hard time with this.Īfter a couple hours of playing around with ideas and checking online, I thought I'd just ask the question to save time. I've seen this done in RPGs on Roblox before, so I know it's possible, and probably fairly easy. I've pretty much got it, but instead of rotating the character model, it turns the screen black and kills the player. What I'm trying to accomplish is to detect when a player has pressed their right mouse button, and through a loop, rotate their character based on the CFrame of the camera until the button is released. In Roblox, your camera has a CFrame with a lookVector and so on.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |