Exemple #1
0
 protected void CreateColliders()
 {
     ColliderParams.Clear();
     for (int i = 0; i < MainElement.Elements("collider").Count(); i++)
     {
         var    element = MainElement.Elements("collider").ElementAt(i);
         string name    = i > 0 ? "Secondary Collider" : "Main Collider";
         ColliderParams.Add(new ColliderParams(element, this, name));
     }
 }
Exemple #2
0
        public PhysicsBody(ColliderParams colliderParams, Vector2 position)
        {
            float radius = ConvertUnits.ToSimUnits(colliderParams.Radius) * colliderParams.Ragdoll.LimbScale;
            float height = ConvertUnits.ToSimUnits(colliderParams.Height) * colliderParams.Ragdoll.LimbScale;
            float width  = ConvertUnits.ToSimUnits(colliderParams.Width) * colliderParams.Ragdoll.LimbScale;

            density = 10;
            CreateBody(width, height, radius, density);
            body.BodyType            = BodyType.Dynamic;
            body.CollidesWith        = Physics.CollisionWall | Physics.CollisionLevel;
            body.CollisionCategories = Physics.CollisionCharacter;
            body.AngularDamping      = 5.0f;
            body.FixedRotation       = true;
            body.Friction            = 0.05f;
            body.Restitution         = 0.05f;
            SetTransformIgnoreContacts(position, 0.0f);
            LastSentPosition = position;
            list.Add(this);
        }
Exemple #3
0
 public PhysicsBody(ColliderParams cParams) : this(cParams, Vector2.Zero)
 {
 }
Exemple #4
0
 protected IEnumerable <RagdollSubParams> GetAllSubParams() =>
 ColliderParams.Select(c => c as RagdollSubParams)
 .Concat(Limbs.Select(j => j as RagdollSubParams)
         .Concat(Joints.Select(j => j as RagdollSubParams)));