• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


28 Nov, 2024

Updated at 02 Dec, 2024

Making ADS w/ original character arms for viewmodel

Probably my first time asking for help here and I hope I would receive some.

Anyways I am trying to make an ADS system by manipulating the players arms and I am failing to do so.

I am sure you all know what ADS is which basically means making a gun aim properly.

I am using a basic CFrame math that moves the players arms to the players camera to simulate a ViewModel. It works extremely well! But the issue occurs when it comes to finding a formula for aiming.


With this code.

		local aimSight = tool:FindFirstChild("AimSight",true)
		
		Aim_ArmOffset = Camera.CFrame:VectorToObjectSpace(Camera.CFrame.Position-aimSight.WorldPosition)
		
		local torsoToCamera = Torso.CFrame:ToObjectSpace(Camera.CFrame)
		armOffset = armOffset:Lerp(cameraCFrames.BobbleCFrame*CFrame.new(0,-1.4,-0.6)*CFrame.Angles(0,cameraVelocityY*2,cameraVelocityY/2),deltaTime*10)
		shoulderCFrames.rightShoulderC0 = torsoToCamera*CFrame.new(Aim_ArmOffset)*armOffset
		shoulderCFrames.leftShoulderC0 = torsoToCamera*armOffset

Of course! I am not going to show my entire code but this is the most you need to know. It shows an aimSight attachment and Aim_ArmOffset which is where the real maths come and where I fail.

What I want is:

  • How can I correctly position the arm in the center of the screen?
  • I want the math to update every frame, and stay stable.

I have tried:

  • Skipping this and using animations.
  • Using manual offsets (which works but sucks.)

That’s all thanks.

1 post - 1 participant

Read full topic