Writing an FPS framework (2020)

Apologies if I look stupid for asking this but would it be difficult to add a dual rendering scope system?

1 Like

itā€™s a really bad idea
porting code over to the framework would be easy (probably ) but i havent done it myself

1 Like

When I animate the viewmodel I couldnā€™t move the actual gun, instead it moved the arms. I could move everything just fine except the gun.

https://gyazo.com/5d96269edba684d6c32b738adfd33ee1

ā€œMainā€ is basically the receiver in the gun. I set all of the part 1ā€™s and part 0ā€™s in the motor6dā€™s as if the script was doing it.

1 Like

I canā€™t help with badly setup rigs since thereā€™s a thousand things that can go wrong with them
check if anything is anchored or if part1/part0 are flipped

1 Like

Hello, @BlackShibe, I want to say that I used your Open Source place, but I cannot seem to open the animations using Moon Animator, what do I do?

2 Likes

Could you perhaps explain the camera animation part more?
I tried putting your code (

	local animatorCFrameDifference = self.lastReceiverRelativity or CFrame.new() * self.viewmodel.camera.CFrame:ToObjectSpace(self.viewmodel.rootPart.CFrame):Inverse()
		local x,y,z = animatorCFrameDifference:ToOrientation()
		workspace.Camera.CFrame = workspace.Camera.CFrame * CFrame.Angles(x,y,z)
		self.lastReceiverRelativity = self.viewmodel.camera.CFrame:ToObjectSpace(self.viewmodel.rootPart.CFrame)

) into the update function, but for some reason, something interesting to say the least happens:robloxapp-20210501-1813552.wmv (1.5 MB)

I have little understanding of it considering its old and to be honest poorly named/written
if you want to fix it, please rewrite it yourself - the basic idea is:

  • Get the rotation of the camera part
  • Rotate the camera based on it
  • Save it for the next frame
  • When the next frame hits, move the camera back to where it was originally so camera movement doesnt stack

Or

  • Measure the difference between the camera part rotation now and 1 frame ago
  • Apply it to the camera

Edit: removed the code snippet from the tutorial for now

2 Likes

Very good tutorial but I have a question:

How would I make this work with a gun selection system? For example, you choose an AK47 and a M9 and then when you spawn in it will give you an AK47 and M9.

Thanks in advance

Read part 2, it includes server code that controls weapon selection

1 Like

Hi, nice tutorial, I really liked it and would love to see new tutorials like this. But Iā€™m having a problem with the camera CFrame, hereā€™s how it looks like:

I tried using the command bar as @BIackShibe said, thanks to him, I added this to the command bar:

workspace.Camera.viewmodel.offsets.idle.Value = CFrame.new(0.7,-1.2,-1.1) * CFrame.Angles(0.005,math.pi / 2 + 0.005,0)

But the position of the gun is still the same, can anyone help me, please? I would really appreciate it!

did you click enter on the command bar?

Yes, and nothing changes, it only changes the value of the idle CFrame value and doesnā€™t change the Camera CFrame, and when I set the camera CFrame to the idle.Value it just rotates my camera about 90 degrees.

can you provide a video example

sure, but the video might be a bit too long, so I donā€™t know if it will send it here or not.

Hereā€™s the link for it, I think you might have to download the video tho, ShowCase.mp4 - Google Drive

just say the video. try doing something like this

this is the update function which i then put into render stepped like this

ā€“ModuleScript

function Secondary:Update(dt)
	if self.viewModel then 
		local finalOffset = self.viewModel.offset.idle.Value
		
		self.viewModel.Root.CFrame = workspace.CurrentCamera.CFrame:ToWorldSpace(finalOffset)
	end
end

ā€“localScript

function update(dt)
	newHandler:Update(dt)
end

did that solve the issue? (need to get this to 30)

1 Like

Where do I place them please? Iā€™m sorry, Iā€™m trying to understand it and finish it.

2 Likes

Sorry late reply but did you read the entire tutorial? the poster explanes how to do this

1 Like

Yes, I did, Iā€™ll try to look more into it, thank you!

1 Like