Example #1
0
 public RespawnPoint(MyVector pos, MyVector rotation, GameTeam team)
 {
     position = pos;
     timeSinceUse = RespawnCooldown;
     orientation = MyQuaternion.FromEulerAngles(rotation.X, rotation.Y, rotation.Z);
     this.team = team;
 }
 internal CFace(uint v1, uint v2, uint v3, MyVector normal)
 {
     this.v1 = v1;
     this.v2 = v2;
     this.v3 = v3;
     n = normal;
 }
        public CollidableBox(MyVector pos, float size, bool flipped)
            : base(new PhysicalProperties(0.4f,1300,0.6f,1f))
        {
            m_data.Position = pos;
            m_data.Acceleration = new MyVector(0, 0, 0);
            m_data.AngularAcceleration = new MyVector(0, 0, 0);
            m_data.AngularVelocity = new MyVector(0, 0, 0);
            m_data.Velocity = new MyVector(0, 0, 0);
            m_data.VelocityBody = new MyVector(0, 0, 0);
            m_data.Orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
            m_data.Mass = size * size * size;
            m_data.Forces = new MyVector(0, 0, 0);
            m_data.Moments = new MyVector(0, 0, 0);

            float moment = 1 / 4f * m_data.Mass * (size * size);
            m_data.Inertia = new MyMatrix(moment, 0, 0, 0, moment, 0, 0, 0, moment);
            m_data.InertiaInverse = m_data.Inertia.Inverse;
            m_flipped = flipped;
            m_size = size;
            m_radius = 0.5f * size * (float)Math.Sqrt(2);
            //if (flipped)
            //    CreateMeshFlipped();
            //else
            //    CreateMesh();

            if (flipped)
                m_collisionMesh = CollisionMesh.FromFile(DefaultValues.MeshPath + "box1.cm", true, size / 70);
            else
                m_collisionMesh = CollisionMesh.FromFile(DefaultValues.MeshPath + "box1.cm", false, size / 70);
        }
Example #4
0
 public StaticMesh(ICollisionData cdata, CollisionDataType cdataType, RenderingData rdata, MyVector position, MyVector rotation)
 {
     collisionDataType = cdataType;
     collisionData = cdata;
     renderingData = rdata;
     this.Position = position;
     this.Orientation = MyQuaternion.FromEulerAngles(rotation.X, rotation.Y, rotation.Z);
 }
Example #5
0
 //StaticBodyData bodyData;
 public StaticMesh(ICollisionData cdata, CollisionDataType cdataType, RenderingData rdata, MyVector position)
 {
     collisionDataType = cdataType;
     collisionData = cdata;
     renderingData = rdata;
     this.Position = position;
     //bodyData.Orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
     this.Orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
 }
Example #6
0
 public WeaponPickup(WeaponClass w,MyVector pos,MyQuaternion orientation)
     : base(new PhysicalProperties(0,0))
 {
     weaponClass = w;
     StaticBodyData data = this.StaticBodyData;
     data.Position = pos;
     data.Orientation = orientation;
     this.StaticBodyData = data;
     timeSinceLastUse = weaponClass.PickupReuseTime;
 }
Example #7
0
        public Particle(MyVector velocity, MyVector position,float angularVelocity, IParticleClass particleClass, float maxLifeTime)
        {
            this.velocity = velocity;
            this.position = position;
            this.particleClass = particleClass;
            this.maxLifetime = maxLifeTime;

            this.angularVelocity = angularVelocity;
            rotation = 0;
        }
Example #8
0
        public Arrow(object owner, WeaponClass weaponClass, MyVector position, MyQuaternion orientation, MyVector velocity)
            : base(new PhysicalProperties(0, 0, 0))
        {
            this.owner = owner;
            this.weaponClass = weaponClass;

            PointMassData data = this.PointMassData;

            data.Position = position;
            data.Orientation = orientation;
            data.Velocity = velocity;
            data.Mass = 0;
            this.PointMassData = data;
            remainingTime = weaponClass.WeaponParameters.ParticleLifetime;
        }
        public BillboardObject(MyVector position, MyVector up, MyVector right, Color color)
        {
            this.position = (Vector3)position;
            verts[0].Position = (Vector3)(-right + up);
            verts[0].Tu = 0; verts[0].Tv = 1;

            verts[1].Position = (Vector3)(-right - up);
            verts[1].Tu = 0; verts[1].Tv = 0;

            verts[2].Position = (Vector3)(right + up);
            verts[2].Tu = 1; verts[2].Tv = 1;

            verts[3].Position = (Vector3)(right - up);
            verts[3].Tu = 1; verts[3].Tv = 0;

            verts[0].Color = verts[1].Color = verts[2].Color = verts[3].Color = color.ToArgb();
        }
        public CollidableSpherePM(MyVector pos, float radius)
            : base(new PhysicalProperties(0.2f,0.3f,1))
        {
            m_boundingSphere = new CollisionSphere(radius);
            m_data.Position = pos;
            m_data.Acceleration = new MyVector(0, 0, 0);
            //m_data.AngularAcceleration = new MyVector(0, 0, 0);
            //m_data.AngularVelocity = new MyVector(0, 0, 0);
            m_data.Velocity = new MyVector(0, 0, 0);
            m_data.VelocityBody = new MyVector(0, 0, 0);
            m_data.Orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
            m_data.Mass = radius * radius * radius;
            m_data.Forces = new MyVector(0, 0, 0);
            //m_data.Moments = new MyVector(0, 0, 0);

            //float moment = 0.4f * m_data.Mass * m_boundingSphere.Radius * m_boundingSphere.Radius;
            //m_data.Inertia = new MyMatrix(moment, 0, 0, 0, moment, 0, 0, 0, moment);
            //m_data.InertiaInverse = m_data.Inertia.Inverse;
        }
Example #11
0
 public BillboardObject MakeBillboardObject(MyVector position, float size)
 {
     BillboardObject obj = new BillboardObject(position, cameraUp * (size / 2), cameraRight * (size / 2));
     return obj;
 }
Example #12
0
 public Star(string mapName, MyVector direction,ColorValue color)
 {
     starTexture = ResourceCache.Instance.GetTexture(mapName);
     lightDirection = direction;
     lightColor = color;
 }
Example #13
0
 public RespawnPoint(MyVector pos)
 {
     position = pos;
     timeSinceUse = RespawnCooldown;
     orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
 }
Example #14
0
        public virtual MyVector PointToLocalCoords(MyVector v)
        {
            MyVector w;
            w = v - m_data.Position;

            w.Rotate(~m_data.Orientation);
            return w;
        }
 public MyQuaternion WalkOrientationFromDirection(MyVector direction)
 {
     Matrix rot = Matrix.LookAtRH(new Vector3(0, 0, 0), new Vector3(direction.X, 0, direction.Z), new Vector3(0, 1, 0));
     rot.Invert();
     Quaternion q = Quaternion.RotationMatrix(rot);
     return (MyQuaternion)q;
 }
Example #16
0
 public virtual MyVector NormalToLocalCoords(MyVector v)
 {
     MyVector w = v;
     w.Rotate(~m_data.Orientation);
     return w;
 }
Example #17
0
 public abstract IMissile GetMissile(object owner, MyVector position, MyQuaternion orientation);
Example #18
0
        public Explosion MakeExplosion(MyVector position, float size)
        {
            Explosion exp = new Explosion();
            exp.Position = position;
            exp.Size = size;
            exp.ExplosionMap = ResourceCache.Instance.GetAnimatedTexture("explosion1.amd").GetAnimationInstance();
            exp.ExplosionMap.Start();
            exp.ExplosionMap.Loop = false;

            explosions.Add(exp);
            return exp;
        }
Example #19
0
 public BillboardObject MakeBillboardObject(MyVector position, float width, float height)
 {
     BillboardObject obj = new BillboardObject(position, cameraUp * (height / 2), cameraRight * (width / 2));
     return obj;
 }
Example #20
0
        public bool Update(float timeElapsed)
        {
            currentTime += timeElapsed;

            position += velocity * timeElapsed;
            rotation += timeElapsed * angularVelocity;
            return false;
        }
Example #21
0
 public Explosion MakeExplosion(MyVector position)
 {
     return MakeExplosion(position, 10f);
 }
Example #22
0
 public static MyQuaternion FromAxisAngle(float angle, MyVector axis)
 {
     MyQuaternion q = new MyQuaternion();
     q.n = (float)Math.Cos(angle / 2);
     q.v.X = axis.X * ((float)Math.Sin(angle / 2));
     q.v.Y = axis.Y * ((float)Math.Sin(angle / 2));
     q.v.Z = axis.Z * ((float)Math.Sin(angle / 2));
     return q;
 }
Example #23
0
        public void SetUp(MyVector pos, MyVector look, MyVector up, MyVector vel)
        {
            this.cameraPosition = pos;
            this.cameraLookDir = look;
            this.cameraUp = up;

            this.cameraRight = cameraLookDir.Cross(cameraUp);
            this.cameraVelocity = vel;

            this.ShaderConstants.World = Matrix.Identity;
            ShaderConstants.SetCamera(pos, up, look);
        }
Example #24
0
 public MyQuaternion(float n, MyVector v)
 {
     this.n = n;
     this.v = v;
 }
Example #25
0
 public WeaponPickup GetWeaponPickup(MyVector position, MyQuaternion orientation)
 {
     WeaponPickup w = new WeaponPickup(this, position, orientation);
     return w;
 }
Example #26
0
 public MyVector EulerAngles()
 {
     MyMatrix m = RotationMatrix;
     MyVector v = new MyVector();
     float tmp = Math.Abs(m.M31);
     if (tmp > 0.999999)
     {
         v.X = 0.0f; //roll
         v.Y = (float)(-(Math.PI / 2) * m.M31 / tmp);
         v.Z = (float)Math.Atan2(-m.M12, -m.M31 * m.M13);
     }
     else
     {
         v.X = (float)Math.Atan2(m.M32, m.M33);
         v.Y = (float)(-m.M31);
         v.Z = (float)Math.Atan2(m.M21, m.M11);
     }
     return v;
 }
Example #27
0
 public virtual MyVector PointToGlobalCoords(MyVector v)
 {
     MyVector w = v;
     w.Rotate(m_data.Orientation);
     w.Add(m_data.Position);
     return w;
 }
Example #28
0
 public MyQuaternion Rotate(MyQuaternion q)
 {
     MyQuaternion t = (q) * (this) * (~q);
     n = t.n;
     v = t.v;
     return this;
 }
Example #29
0
 public SwordBlade(object owner, WeaponClass weaponClass, MyVector position, MyQuaternion orientation, MyVector velocity)
     : base(new PhysicalProperties(0, 0, 0))
 {
 }
Example #30
0
 public MyQuaternion(float n, float x, float y, float z)
 {
     this.n = n;
     this.v = new MyVector(x, y, z);
 }