• Physgun rotation
    6 replies, posted
I'd just like to know how Physics gun rotation is calculated when I hold E.
Its about C++ not Lua
[QUOTE=vBatuhan;29779817]Its about C++ not Lua[/QUOTE] Yes, but how to do same in Lua? Ideal code (Not lua or any language. Also it does not work) [code] // aLookUp = the speed mouse moves up/down. // aTurn = the speed mouse moves left/right. // local = by default 0. local rotator newRotation, oldRotation; local vector X,Y,Z; oldRotation = target.Rotation; Mouseup: newRotation.Pitch = -(32.0 * aLookUp); Mouseleft/right. newRotation.Yaw = -(32.0 * aTurn); GetAxes(oldRotation,X,Y,Z); X = X>>newRotation; Y = Y>>newRotation; Z = Z>>newRotation; oldRotation = OrthoRotation(X,Y,Z); target.Rotation = oldRotation; [/code]
[QUOTE=rute;29779834]Yes, but how to do same in Lua? Ideal code (Not lua or any language. Also it does not work) [code] // aLookUp = the speed mouse moves up/down. // aTurn = the speed mouse moves left/right. // local = by default 0. local rotator newRotation, oldRotation; local vector X,Y,Z; oldRotation = target.Rotation; Mouseup: newRotation.Pitch = -(32.0 * aLookUp); Mouseleft/right. newRotation.Yaw = -(32.0 * aTurn); GetAxes(oldRotation,X,Y,Z); X = X>>newRotation; Y = Y>>newRotation; Z = Z>>newRotation; oldRotation = OrthoRotation(X,Y,Z); target.Rotation = oldRotation; [/code][/QUOTE] Why you are wondering you dont need to recode it use default gmod rotation system whats wrong with that ?
[QUOTE=vBatuhan;29783193]Why you are wondering you dont need to recode it use default gmod rotation system whats wrong with that ?[/QUOTE] Because I want to know how it work.
I'm pretty sure it's a simple rotation around a given vector, look this thing up on the internets.
Sorry, you need to Log In to post a reply to this thread.