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_RIGID;
- physParams.nSlot = CCharacter::eGeometry_Character;
- physParams.mass = m_pCharacter->GetCVars().m_mass;
- //physParams.nFlagsAND = pef_log_collisions | pef_monitor_collisions;
- //physParams.nFlagsOR = geom_collides | geom_colltype_player;
- //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;
- ////playerDynamics.collTypes = collision_class_game | collision_class_terrain;
- //physParams.pPlayerDynamics = &playerDynamics;
- entity.Physicalize(physParams);
- entity.EnablePhysics(true);
- pe_geomparams gp;
- gp.flags = geom_colltype_solid;
- gp.flagsCollider = geom_colltype1;
- gp.mass = 10.0f;
- gp.density = 0.0f;
- primitives::capsule capsule;
- capsule.center = Vec3(0.0f,0.0f,1.0f);
- capsule.r = 0.5f;
- capsule.hh = 0.5f;
- capsule.axis = Vec3(0.0f, 0.0f, 1.0f);
- IGeometry *pcaps = gEnv->pPhysicalWorld->GetGeomManager()->CreatePrimitive(primitives::capsule::type, &capsule);
- phys_geometry *pGeom = gEnv->pPhysicalWorld->GetGeomManager()->RegisterGeometry(pcaps);
- pcaps->Release();
- entity.GetPhysics()->AddGeometry(pGeom, &gp);
- pGeom->nRefCount--;
- pe_simulation_params pa;
- pa.maxRotVel = 0.0f;
- entity.GetPhysics()->SetParams(&pa);
- //pe_action_add_constraint ic;
- //ic.pBuddy = entity.GetPhysics();
- //ic.flags = constraint_no_rotation;
- //ic.pt[0].Set(0, 0, 0);
- //ic.damping = 1.0f;
- ////ic.pt[1].Set(0, 0, 1);
- //ic.xlimits[0] = 0.0f;
- //ic.xlimits[1] = 0.0f;
- //ic.yzlimits[0] = 0.0f;
- //ic.yzlimits[1] = 0.0f;
- //pe_action_update_constraint updateConst;
- //updateConst.flagsAND = constraint_no_rotation;
- //updateConst.idConstraint = 1;
- //entity.GetPhysics()->Action(&ic);
- //entity.GetPhysics()->Action(&updateConst);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement