7 m_pCharacter = pCharacter;
8 m_pController = pController;
9 m_AnimationComponent = CharacterAnimationComponent.Cast(pAnimPhysComponent);
11 m_Input = pController.GetInputContext();
16 override void OnActivate()
18 m_AnimationComponent.PhysicsEnableGravity(
false);
22 override void OnDeactivate()
24 Print(
"SCR_CharacterCommandFly::OnDeactivate");
25 m_AnimationComponent.PhysicsEnableGravity(
true);
30 override void PreAnimUpdate(
float pDt)
37 override void PrePhysUpdate(
float pDt)
39 Print(
"SCR_CharacterCommandFly::PrePhysUpdate: " + pDt.ToString());
41 vector trans = vector.Zero;
44 PrePhys_GetTranslation(trans);
51 float swimSpeedX = 0, swimSpeedZ = 0, swimSpeedY = 0;
54 vector movDir = m_pController.GetMovementDirWorld();
57 if (movDir.Length() > 0)
59 swimSpeedZ = movDir[2] * m_fMovementSpeed;
63 if (m_Input.GetJump() > 0)
77 m_fSpeedX = Math.SmoothCD(m_fSpeedX, swimSpeedX, m_fSpeedXV, m_fMovementSpeedFltTime, m_fMovementSpeedFltMaxChange, pDt);
78 m_fSpeedY = Math.SmoothCD(m_fSpeedY, swimSpeedY, m_fSpeedYV, m_fMovementSpeedFltTime, m_fMovementSpeedFltMaxChange, pDt);
79 m_fSpeedZ = Math.SmoothCD(m_fSpeedZ, swimSpeedZ, m_fSpeedZV, m_fMovementSpeedFltTime, m_fMovementSpeedFltMaxChange, pDt);
82 trans[0] = trans[0] + m_fSpeedX * pDt;
83 trans[1] = trans[1] + m_fSpeedY * pDt;
84 trans[2] = trans[2] + m_fSpeedZ * pDt;
87 PrePhys_SetTranslation(trans);
92 override bool PostPhysUpdate(
float pDt)
94 Print(
"SCR_CharacterCommandFly::PostPhysUpdate: " + pDt.ToString());
105 ChimeraCharacter m_pCharacter;
106 CharacterControllerComponent m_pController;
108 CharacterAnimationComponent m_AnimationComponent;
121 float m_fMovementSpeed = 25;
122 float m_fMovementSpeedFltTime = 0.3;
123 float m_fMovementSpeedFltMaxChange = 100;