Is it possible to make the player arms visible and follow the mouse while in first person so it does not look like they are floating? (Like FPS)
I hope this question is not stupid.
What I do is instead of making the arms follow the mouse, I weld my arms to the head of my character, offset the welds accordingly using the C1 property of the weld (this is so that the arms aren't inside of your head when you test the gun and it may need tweaking tons of times) and then use the following piece of code to find the angle that my mouse is looking up by, connecting the function to the RenderStepped
event in the RunService
, so your arms keep following the mouse on the Y axis.
game:GetService("RunService").RenderStepped:Connect(function() --Runs the function each time a frame is rendered. mouse.TargetFilter = workspace --This is important when setting the C0 at the bottom as it ignores everything in the workspace to give clean movement of the arms on the Y axis. player.Character.Torso.Neck.C1 = CFrame.new() --Sets the C1 to a blank CFrame so the head doesn't glitch. player.Character.Torso.Neck.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0) --Moves the head up by 1.5 studs and then sets the angle of your character's neck looking up towards the mouse using inverse trigonometry (A grade maths) and unit vectors (so you only get the direction.) end)
The math function that is used to calculate the angle of the mouse looking up is called math.asin
. math.asin is a trigonometric function known as the arc sine, or inverse sine. Inverse trigonometry is A grade mathematical work and is quite confusing until you're taught it by your subject teacher, so I will not explain this fully as I am not a very good teacher with these sorts of things.
If you really want to know how to do the inverse sine, here is a link to a maths website which explains it quite well. I'm sorry that I can't explain inverse trigonometry to you personally as I am not a very good teacher.
I hope this helped you. If it did, please accept my answer.
Locked by Spongocardo and dyler3
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?