public override void CreateCharacterCollision(Vector3 center, float characterWidth, float characterHeight, float crouchHeight, float ladderHeight, float headSize, float headHeight, MatrixD worldTransform, float mass, ushort collisionLayer, bool isOnlyVertical, float maxSlope, bool networkProxy) { Center = center; CanUpdateAccelerations = false; if (networkProxy) { //create kinematic body for network proxy HkShape shape = MyCharacterProxy.CreateCharacterShape(characterHeight, characterWidth, characterHeight + headHeight, headSize, 0.0f); HkMassProperties massProperties = new HkMassProperties(); massProperties.Mass = mass; massProperties.InertiaTensor = Matrix.Identity; massProperties.Volume = characterWidth * characterWidth * (characterHeight + 2 * characterWidth); CreateFromCollisionObject(shape, center, worldTransform, massProperties, collisionLayer); CanUpdateAccelerations = false; return; } Vector3 transformedCenter = Vector3.TransformNormal(Center, worldTransform); Matrix worldTransformCentered = Matrix.CreateWorld(transformedCenter + worldTransform.Translation, worldTransform.Forward, worldTransform.Up); CharacterProxy = new MyCharacterProxy( #if DYNAMIC_CHARACTER_CONTROLLER true, #else false, #endif true, characterWidth, characterHeight, crouchHeight, ladderHeight, headSize, headHeight, worldTransformCentered.Translation, worldTransform.Up, worldTransform.Forward, mass, this, isOnlyVertical, maxSlope); //CharacterProxy.Gravity = new Vector3(0, -20, 0); }
public override void CreateCharacterCollision(Vector3 center, float characterWidth, float characterHeight, float crouchHeight, float ladderHeight, float headSize, float headHeight, MatrixD worldTransform, float mass, ushort collisionLayer, bool isOnlyVertical, float maxSlope, float maxImpulse, float maxSpeedRelativeToShip, bool networkProxy, float? maxForce = null) { Center = center; CanUpdateAccelerations = false; if (networkProxy) { //create kinematic body for network proxy HkShape shape = MyCharacterProxy.CreateCharacterShape(characterHeight, characterWidth, characterHeight + headHeight, headSize, 0.0f); HkMassProperties massProperties = new HkMassProperties(); massProperties.Mass = mass; massProperties.InertiaTensor = Matrix.Identity; massProperties.Volume = characterWidth * characterWidth * (characterHeight + 2 * characterWidth); CreateFromCollisionObject(shape, center, worldTransform, massProperties, collisionLayer); CanUpdateAccelerations = false; return; } Vector3 transformedCenter = Vector3.TransformNormal(Center, worldTransform); Matrix worldTransformCentered = Matrix.CreateWorld(transformedCenter + worldTransform.Translation, worldTransform.Forward, worldTransform.Up); CharacterProxy = new MyCharacterProxy( #if DYNAMIC_CHARACTER_CONTROLLER true, #else false, #endif true, characterWidth, characterHeight, crouchHeight, ladderHeight, headSize, headHeight, worldTransformCentered.Translation, worldTransform.Up, worldTransform.Forward, mass, this, isOnlyVertical, maxSlope, maxImpulse, maxSpeedRelativeToShip, maxForce); //Unreliable, using fall sounds only now (when hiting ground with feet) //CharacterProxy.GetRigidBody().ContactSoundCallback += MyPhysicsBody_ContactSoundCallback; //CharacterProxy.GetRigidBody().ContactSoundCallbackEnabled = true; CharacterProxy.GetRigidBody().ContactPointCallbackDelay = 0; //CharacterProxy.Gravity = new Vector3(0, -20, 0); }