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

Camera manipulation, Weld camera to object in first person?

Asked by 6 years ago

I'm trying to make an FPS gun, and I want my arms to follow the camera angle. I used this transform function to make the arms go up and down:

char.Torso["Left Shoulder"].Transform = char.Torso["Left Shoulder"].Transform * CFrame.fromEulerAnglesXYZ(0, 0, -math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))

char.Torso["Right Shoulder"].Transform = char.Torso["Right Shoulder"].Transform *   CFrame.fromEulerAnglesXYZ(0, 0, math.asin((mouse.Hit.p - mouse.Origin.p).unit.y))

But now the arms don't rotate alongside the Camera. I tried welding the arms to the head, but then I can't use any animations since I have to set the Part1 value of the motor6Ds to nil. So I thought: can I just move the camera alongside the gun?

Welding the camera directly to the arms and gun is impossible, so I made a part that is in the correct location and simply put that part as camerasubject. This made the arms go up and down and rotated alongside with the camera, achieving the desired effect, but now my camera isn't first person anymore. So if i move my mouse around the x-axis the character doesn't follow...

Is there a way I can make it so the character model of the player still follows regular first person movement, while the camerasubject is a part? Could I make the character model rotate if I move my camera on the x-axis?

Any help is appreciated. C:

Answer this question