How to fix the camera on an object

I have been reworking an entire weapon system to work properly in first person. My goal is to simulate rainbow six siege aiming style. The current problem is that whenever I set the cameras position to an attachment that is on the scope, there is a delay between the camera and the object.

Here is what I am trying to achieve: (The scope and the camera are welded thogether and are smooth)

Here is what I have:

As you can see, the camera doesnt stay attached to the gun, it sort of like springs to it.
Here is the code I use:

if self.zoomState then
	local body = self.currentTool:FindFirstChildWhichIsA("Model").Frame.AimPosition
	self.currentCFrame = body.WorldCFrame
end

(All of this is on renderStepped. Its playing every frame)

Anyone has an Idea on how I could make this better?

1 Like

Ok, I think the delay is caused by the renderstep. Instead, I now have a 2nd camera inside my scope.
The problem is that the camera keeps dissapearing when I load the game up.

In studio:
image

In game:
image

Anyone knows why?

Cameras are not replicated, that’s why.

Also, the problem is that you’re not using a viewmodel or the viewmodel is welded to the character.

1 Like

What is a viewmodel? I dont think I have one because the weapon rotates with the character.

The weird thing is, the weapon is perfectly following my mouse when I move it in hipfire.

Here is another video to compare:

As you can see, when im not aiming, the gun is perfectly following the camera. But whenever I aim the camera has a hard time following the weapon. Anyone has an advice on how I could fix the camera to the gun?

Dont, that is what makes it look realistic

There is a big line between realistic and unplayable. I mean I would keep it if it was like phantom force, but it is way too blatant. And my game will not focus on realism but on intensive gameplay.

1 Like

A viewmodel is this:


Also, is the camera type Scriptable?

1 Like

Well, are you using offset or a renderstep to put the cam cframe on a part which is for aiming

1 Like

I decided to completely remake my weapon system because It was too hard to modify premade librairies. I watched plenty of videos on viewmodels, I fully understand what you mean and I plan on using it. Thank you for your help.

Renderstep, this is probably why the camera was so weird. Since its position was updated every deltaTime and the priority was under 300.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.