Advertisement
Guest User

Untitled

a guest
Sep 6th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. void CCharacterMovement::Physicalize()
  2. {
  3.     // Physicalize the player as type Living.
  4.     // This physical entity type is specifically implemented for players
  5.     SEntityPhysicalizeParams physParams;
  6.     physParams.type = PE_LIVING;
  7.     physParams.nSlot = -1;
  8.     physParams.mass = m_pCharacter->GetCVars().m_mass;
  9.  
  10.     pe_player_dimensions playerDimensions;
  11.  
  12.     // Prefer usage of a cylinder instead of capsule
  13.     playerDimensions.bUseCapsule = 0;
  14.  
  15.     // Specify the size of our cylinder
  16.     playerDimensions.sizeCollider = Vec3(0.5f, 0.5f, 1.0f);
  17.  
  18.     // Keep pivot at the player's feet (defined in player geometry)
  19.     playerDimensions.heightPivot = 0.f;
  20.     // Offset collider upwards
  21.     playerDimensions.heightCollider = 1.f;
  22.     playerDimensions.groundContactEps = 0.004f;
  23.  
  24.     physParams.pPlayerDimensions = &playerDimensions;
  25.  
  26.     pe_player_dynamics playerDynamics;
  27.     playerDynamics.kAirControl = 0.f;
  28.     playerDynamics.mass = physParams.mass;
  29.    
  30.  
  31.     physParams.pPlayerDynamics = &playerDynamics;
  32.  
  33.     GetEntity()->Physicalize(physParams);
  34.     GetEntity()->EnablePhysics(true);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement