Pistol hold type

Is there a way to create a new hold type that would be 90 degrees for example could you have a pistol hold type that would be shifted 90 degrees so it would be like this

yes ?

I think you need to manipulate.

Yes, you can rotate the viewmodel in CalcViewModelView by returning the new position/angle.

Anyway you could give an example of this in a SWEP? I was thinking along the lines of


function SWEP:CalcViewModelView( ent, oldPos, oldAng, pos, ang )

      ang:RotateAroundAxis(ang:Right(), -90)
end

But haven’t tested it.

That’s the right idea yeah, although I think you might have to update the position as well so it stays on the side of the screen you want it to

Do you have an example because I can’t seem to get it right, My model keeps chaning position :confused:

https://gyazo.com/f5df51014a088f63076606e954af74b6.png

You have to return the angle you changed. Ex.


function SWEP:CalcViewModelView(pViewModel, vPos, aRot, vNewPos, aNewRot)
   aNewRot:RotateAroundAxis(aNewRot:Right(), -90)
   
   return vNewPos, aNewRot
end

Note that the “new” vector and angle includes the default bobbing. If you want to disable that, use the first two, instead.

I had almost the exact same code the issue with mine(and yours) is the gun is gone :confused: I can’t figure out whats wrong. Do I need to set the vector aswell or?

You may need to move the viewmodel up to compensate for the rotation, if that rotation is even on the correct axis. Start with minimal changes to the angle/position until you can see the general gist of the direction.


function SWEP:CalcViewModelView(pViewModel, vPos, aRot, vNewPos, aNewRot)

   aNewRot:RotateAroundAxis(aNewRot:Forward(), -90)
   aNewRot:RotateAroundAxis(aNewRot:Right(), -10)
   aNewRot:RotateAroundAxis(aNewRot:Up(), 0)

   
   return vNewPos, aNewRot
end

Thanks for the help!

The only issue is:

This is with the code above

This is with the Right() angle changed to 18

The gun is rotated slightly down, how would I change the vector down?