/// <summary> /// Make this element face another element /// </summary> /// <param name="target">The element to face</param> public virtual void FaceElement(PhysicalElement target) { Rotation = NumericHelper.RotationBetweenPositions(Position, target.Position); }
/// <summary> /// Attach this attachable to a toAttachable without any offset /// </summary> public void AttachTo(PhysicalElement toElement) { AttachTo(toElement, Vector3.Zero, Vector3.Zero); }
/// <summary> /// Attach this attachable to a toAttachable with 2 vectors describing a position offset and a rotation offset /// </summary> public void AttachTo(PhysicalElement toElement, Vector3 positionOffset, Vector3 rotationOffset) { MtaShared.AttachElements(element, toElement.MTAElement, positionOffset.X, positionOffset.Y, positionOffset.Z, rotationOffset.X, rotationOffset.Y, rotationOffset.Z); }
/// <summary> /// Attach this attachable to a toAttachable with a vector describing the position offset and a quaternion describing the rotation offset /// </summary> public void AttachTo(PhysicalElement toElement, Vector3 positionOffset, Quaternion rotationOffset) { AttachTo(toElement, positionOffset, NumericHelper.QuaternionToEuler(rotationOffset)); }
/// <summary> /// Attach this attachable to a toAttachable using a matrix to describe the positional and rotational offset /// </summary> public void AttachTo(PhysicalElement toElement, Matrix4x4 offsetMatrix) { AttachTo(toElement, offsetMatrix.Translation, Quaternion.CreateFromRotationMatrix(offsetMatrix)); }