/// <summary> /// /// </summary> protected virtual void UpdateSprings() { m_PositionSpring.FixedUpdate(); m_PositionPivotSpring.FixedUpdate(); m_RotationPivotSpring.FixedUpdate(); m_PositionSpring2.FixedUpdate(); m_RotationSpring.FixedUpdate(); m_RotationSpring2.FixedUpdate(); }
/// <summary> /// /// </summary> protected virtual void UpdateSprings() { // NOTES: // 1) this version of the method should not be run for a 1st person weapon, // only for multiplayer remote players and AI // 2) a 3rd person vp_Weapon is just an invisible, locigal entity, // represented by its '3rdPersonWeapon' gameobject reference in the // 3d world. still, it's good to fix position and rotation so weapon does // not recoil away into oblivion in 3rd person Transform.localPosition = Vector3.up; // middle of player Transform.localRotation = Quaternion.identity; // aiming head-on // update recoil springs for additive position and rotation forces m_PositionSpring2.FixedUpdate(); // TODO: only in 1st person m_RotationSpring2.FixedUpdate(); }
/////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////// protected void FixedUpdate() { // zoom happens here for framerate independence if (m_FinalZoomTime > Time.time) { UpdateZoom(); } // update fall impact, swaying, bobbing and earthquakes UpdateForces(); m_PositionSpring.FixedUpdate(); m_PositionPivotSpring.FixedUpdate(); m_PositionSpring2.FixedUpdate(); m_RotationSpring.FixedUpdate(); m_RotationSpring2.FixedUpdate(); // update camera and weapon shakes UpdateShakes(); }
/////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////// void FixedUpdate() { // zoom happens here for framerate independence if (m_FinalZoomTime > Time.time) { UpdateZoom(); } // update fall impact, swaying, bobbing and earthquakes UpdateForces(); m_PositionSpring.FixedUpdate(); m_PositionSpring2.FixedUpdate(); m_RotationSpring.FixedUpdate(); // update camera and weapon shakes UpdateShakes(); // prevent camera from going through objects DoCameraCollision(); }