public ObjectCombo GetObjectComboOfObject(Managed3DObject obj) { foreach (var objcombo in this) { if (objcombo.ID == obj.ObjectCombo.ID) { return(objcombo); } } return(UnknownCombo); }
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(); }
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(); }
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))); }
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))); }
private void SetObjectPosition(Managed3DObject obj, System.Numerics.Vector3 pos) { obj.Position = pos; }
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); }