Ejemplo n.º 1
0
        public ObjectCombo GetObjectComboOfObject(Managed3DObject obj)
        {
            foreach (var objcombo in this)
            {
                if (objcombo.ID == obj.ObjectCombo.ID)
                {
                    return(objcombo);
                }
            }

            return(UnknownCombo);
        }
Ejemplo n.º 2
0
        private void moveObjectY(Managed3DObject obj, Point e, System.Numerics.Vector3 savedPos, bool forRotation)
        {
            if (!forRotation)
            {
                short newY = Conversions.ToShort(-Math.Truncate(30 * (e.Y - moveObj_UpDown_lastMouseY) * Main.ObjectMoveSpeed));
                obj.Position = new System.Numerics.Vector3(obj.Position.X, savedPos.Y + newY, obj.Position.Z);
            }
            else
            {
                short newY = Conversions.ToShort(-Math.Truncate((double)(e.Y - rotObj_Yaw_lastMouseY)));
                RotateObject(obj, new System.Numerics.Vector3(obj.Rotation.X, newY, obj.Rotation.Z));
            }

            Main.ogl.UpdateOrbitCamera();
        }
Ejemplo n.º 3
0
        private void moveObjectXZ(Managed3DObject obj, Point e, System.Numerics.Vector3 savedPos, bool forRotation)
        {
            float speedMult = 30.0F;
            int   mx, my;

            if (!forRotation)
            {
                mx = e.X - moveObj_lastMouseX;
                my = -(e.Y - moveObj_lastMouseY);
            }
            else
            {
                mx = e.X - rotObj_lastMouseX;
                my = -(e.Y - rotObj_lastMouseY);
            }

            float CX = Conversions.ToSingle(Math.Sin(Main.Camera.Yaw));
            float CZ = Conversions.ToSingle(-Math.Cos(Main.Camera.Yaw));
            float CX_2 = Conversions.ToSingle(Math.Sin(Main.Camera.Yaw + Math.PI / 2));
            float CZ_2 = Conversions.ToSingle(-Math.Cos(Main.Camera.Yaw + Math.PI / 2));
            float newX, newZ;
            float moveSpeed = forRotation ? 1 : Main.ObjectMoveSpeed;

            newX = Conversions.ToSingle(Math.Truncate(savedPos.X - Conversions.ToShort(Math.Truncate(CX * my * speedMult * moveSpeed)) - Conversions.ToShort(Math.Truncate(CX_2 * mx * speedMult * moveSpeed))));
            newZ = Conversions.ToSingle(Math.Truncate(savedPos.Z - Conversions.ToShort(Math.Truncate(CZ * my * speedMult * moveSpeed)) - Conversions.ToShort(Math.Truncate(CZ_2 * mx * speedMult * moveSpeed))));
            if (!forRotation)
            {
                var oldPos = obj.Position;
                var newPos = new System.Numerics.Vector3(Conversions.ToShort(newX), oldPos.Y, Conversions.ToShort(newZ));
                SetObjectPosition(obj, newPos);
            }
            else
            {
                speedMult = 0.5F;
                var oldRot = obj.Rotation;
                var newRot = new System.Numerics.Vector3(newX, oldRot.Y, newZ);
                SetObjectRotation(obj, newRot);
            }

            Main.ogl.UpdateOrbitCamera();
        }
Ejemplo n.º 4
0
 private void SetObjectRotation(Managed3DObject obj, System.Numerics.Vector3 rot)
 {
     obj.Rotation = new System.Numerics.Vector3(Publics.General.KeepDegreesWithin360(Conversions.ToShort(rot.X)), Publics.General.KeepDegreesWithin360(Conversions.ToShort(rot.Y)), Publics.General.KeepDegreesWithin360(Conversions.ToShort(rot.Z)));
 }
Ejemplo n.º 5
0
 private void RotateObject(Managed3DObject obj, System.Numerics.Vector3 val)
 {
     obj.Rotation = new System.Numerics.Vector3(Publics.General.KeepDegreesWithin360(Conversions.ToShort(obj.Rotation.X + val.X)), Publics.General.KeepDegreesWithin360(Conversions.ToShort(obj.Rotation.Y + val.Y)), Publics.General.KeepDegreesWithin360(Conversions.ToShort(obj.Rotation.Z + val.Z)));
 }
Ejemplo n.º 6
0
 private void SetObjectPosition(Managed3DObject obj, System.Numerics.Vector3 pos)
 {
     obj.Position = pos;
 }
Ejemplo n.º 7
0
 private void MoveObject(Managed3DObject obj, System.Numerics.Vector3 val)
 {
     obj.Position = new System.Numerics.Vector3(obj.Position.X + val.X, obj.Position.Y + val.Y, obj.Position.Z + val.Z);
 }