The First Person Element Of A First Person Shooter

When attaching the weapon to the view model with Motor6d, the gun doesn’t align with where the player is facing. Can anybody answer my problem?

I’m pretty new to Motor6d.

It means that the part you’re using to attach the Motor6D with the view model is rotated in a different way.
There are 2 solutions, rotate that part until it aligns with the ViewModel (such as making the forward surface the “Front” one) or just loading an animation onto it.

hey EgoMoose! For some reason whenever i shoot at something it doesnt damage it.
Help is much appreciated, Thanks!

That’s because the tutorial doesn’t include a part about actually making the weapon fire bullets.

There is some sort of new bug with this system. If you move the camera up and down, the torso and head both move up and down, but the arms don’t, if they are playing an animation.

To be clear the arms move with the torso when they are not playing an animation, but if they are then they don’t move at all.

1 Like

I am also having this issue, it causes some really weird arm movement when I rotate up and down. I am using the BodyPosition method that is being updated by the server.

Have you found a solution to this issue?

1 Like

No, I have not found a solution to this issue - it’s clearly on Roblox’s end.

I just want to say that I recommend that you stay away from the body position method, that is a bad way of making a viewmodel(I tried almost every single method possible of making a view model, and found that body position is one of the worst looking ways to go about it, and it also comes with many bugs).

I recommend that you use math to position your viewmodels, but just as a warning this is a very complicated thing to program - assuming you want to have weapon sway, realistic recoil, hands in the right position, avoid clipping into walls, and your code being virtually bug free.

2 Likes

So when it comes to client-server replication, are you suggesting to use EgoMoose’s original method with constant signals?

1 Like

That might not be the best solution because of all the network traffic, and it relies on animations, which don’t seem to be working.

If you want to replicate movement over to the server, then you need to move the torso and neck, like how EgoMoose originally had. Then on top of that you will need to use inverse kinematics to get the arms to touch the weapon, while being connected to the shoulder joint and looking natural. Of course you will also need to interpolate between where you are now and the next frame.

So the frame you just got is where you want to go in 1/10th of a second, and the frame you’re at now is where you start. Once you get to that next frame, which is now the current frame, you wait for the next frame to show up(should have showed up by now) then repeat.

1 Like

Just to let you know (in case for whatever you’re still interested in it), I accidently fixed the arm rotation problem. I made my previous animation using the Roblox inbuilt animation editor, however switched over to using the Moon Animator Plugin, and remade all my animations.

I only realised when testing that the issue is no longer there. I didn’t change any code for this to happen, so I have to guess the Plugin did something to make it work :man_shrugging:

2 Likes

I have same problem, if i try to set RightShoulder’s C0, it doesnt rotate correctly, even though neck and waist are rotating perfectly, ive been searching for the solution for days and didnt found anything, i cant belive they didnt fixed it already.

I am having some weird issues with reload animations as well. I am using the open source FPS place engine that was posted which has a lot more mathmatics (including sway, bobbing, and tilting) to make the viewmodel super smooth :ok_hand: (On a side note can you please add comments to the code? @EgoMoose)

Here’s what’s happening


I made a basic reload animation to test that the viemodel could be animated and I believe the CFrame math is throwing a lot of the positions off.


(The john wick style slanted point aiming is a feature, not a bug)
Here’s what the reload looks like in practice. Notice how the gun stays in place and nothing looks like it did during the animation. I believe the CFrame math (from the sway, bobbing, and tilting mechanics) is throwing it off axis. Can you show how you got your reload animations to work?

Once again, this project was made from the Open Source FPS place link at the bottom of EgoMoose’s post. The only code I changed was adding a reload function in the FPS module and a reload bind in the control local script.

function fps:reload()	
	-- the reload animation track is inside the script as a temporary place until I can get it to work.
	local reloadAnimation = self.viewModel.Humanoid:LoadAnimation(script.ReloadAnim)
	reloadAnimation:Play()
	
	reloadAnimation.Ended:Wait()
end

Could someone send me the file of the place he linked? I’m on mac and whenever I hit Edit it just opens my studio.