Пример #1
0
        public override void RemovePrim(PhysicsActor prim)
        {
            POSPrim p = (POSPrim)prim;

            if (_prims.Contains(p))
            {
                _prims.Remove(p);
            }
        }
Пример #2
0
        private bool isColliding(POSCharacter c, POSPrim p)
        {
            Vector3 rotatedPos = new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y,
                                             c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation);
            Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation);

            return(Math.Abs(rotatedPos.X) < (p.Size.X * 0.5 + Math.Abs(avatarSize.X)) &&
                   Math.Abs(rotatedPos.Y) < (p.Size.Y * 0.5 + Math.Abs(avatarSize.Y)) &&
                   Math.Abs(rotatedPos.Z) < (p.Size.Z * 0.5 + Math.Abs(avatarSize.Z)));
        }
Пример #3
0
        public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                                  Vector3 size, Quaternion rotation, bool isPhysical)
        {
            POSPrim prim = new POSPrim();

            prim.Position    = position;
            prim.Orientation = rotation;
            prim.Size        = size;
            _prims.Add(prim);
            return(prim);
        }
Пример #4
0
 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
                                           Vector3 size, Quaternion rotation, bool isPhysical)
 {
     POSPrim prim = new POSPrim();
     prim.Position = position;
     prim.Orientation = rotation;
     prim.Size = size;
     _prims.Add(prim);
     return prim;
 }
Пример #5
0
        private bool isColliding(POSCharacter c, POSPrim p)
        {
            Vector3 rotatedPos = new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y,
                                             c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation);
            Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation);

            return (Math.Abs(rotatedPos.X) < (p.Size.X*0.5 + Math.Abs(avatarSize.X)) &&
                    Math.Abs(rotatedPos.Y) < (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) &&
                    Math.Abs(rotatedPos.Z) < (p.Size.Z*0.5 + Math.Abs(avatarSize.Z)));
        }
Пример #6
0
        private bool isColliding(POSCharacter c, POSPrim p)
        {
            Vector3 rotatedPos = new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y,
                                             c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation);
            Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation);

            if (Math.Abs(rotatedPos.X) >= (p.Size.X*0.5 + Math.Abs(avatarSize.X)) ||
                Math.Abs(rotatedPos.Y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) ||
                Math.Abs(rotatedPos.Z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.Z)))
            {
                return false;
            }
            return true;
        }