Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CCharacterMovement::Physicalize()
- {
- IEntity &entity = *GetEntity();
- // Physicalize the player as type Living.
- // This physical entity type is specifically implemented for players
- SEntityPhysicalizeParams physParams;
- physParams.type = PE_LIVING;
- physParams.nSlot = -1;
- physParams.mass = m_pCharacter->GetCVars().m_mass;
- pe_player_dimensions playerDimensions;
- // Prefer usage of a cylinder instead of capsule
- playerDimensions.bUseCapsule = 0;
- // Specify the size of our cylinder
- playerDimensions.sizeCollider = Vec3(0.3f, 0.3f, 1.0f);
- // Keep pivot at the player's feet (defined in player geometry)
- playerDimensions.heightPivot = 0.0f;
- // Offset collider upwards
- playerDimensions.heightCollider = 1.0f;
- playerDimensions.groundContactEps = 0.004f;
- physParams.pPlayerDimensions = &playerDimensions;
- pe_player_dynamics playerDynamics;
- playerDynamics.kAirControl = 0.f;
- playerDynamics.mass = physParams.mass;
- playerDynamics.kInertia = 0.01f;
- physParams.pPlayerDynamics = &playerDynamics;
- entity.Physicalize(physParams);
- entity.EnablePhysics(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement