/// <summary> /// Applies the properties of this VirtualTransform to the given VirtualTransform. /// Scale isn't applied unless set to true. /// </summary> /// <param name="virtualTransform">VirtualTransform you want to apply this VirtualTransform's properties to.</param> /// <param name="applyScale">If you also want to apply scale.</param> public void ApplyTo(VirtualTransform virtualTransform, bool applyScale = false) { virtualTransform.Position = this.Position; virtualTransform.Rotation = this.Rotation; if (applyScale) { virtualTransform.LocalScale = this.LocalScale; } }
/// <summary> /// Finds the local rotation of this VirtualTransform using the given parent VirtualTransform rotation. /// </summary> /// <param name="parentTransform">Transform of the parent.</param> /// <returns>Local rotation of this VirtualTransform relative to the parent rotation.</returns> public Quaternion GetLocalRotation(VirtualTransform parentTransform) { return(GetLocalRotation(parentTransform.Rotation)); }
/// <summary> /// Finds the local position of this VirtualTransform using the given parent VirtualTransform's position. /// </summary> /// <param name="parentTransform">The VirtualTransform of the parent.</param> /// <returns>The local position relative to the given parent position.</returns> public Vector3 GetLocalPosition(VirtualTransform parentTransform) { return(GetLocalPosition(parentTransform.Position)); }
/// <summary> /// Rotates the VirtualTransform to look at the position of the given VirtualTransform. /// </summary> /// <param name="virtualTransform">The VirtualTransform whose position in world space to look at.</param> /// <param name="worldUp">Upwards vector.</param> public void LookAt(VirtualTransform virtualTransform, Vector3 worldUp) { LookAt(virtualTransform.Position, worldUp); }
/// <summary> /// Rotates the VirtualTransform to look at the position of the given VirtualTransform. /// Uses Vector3.up as the worldUp vector. /// </summary> /// <param name="virtualTransform">The VirtualTransform whose position in world space to look at.</param> public void LookAt(VirtualTransform virtualTransform) { LookAt(virtualTransform.Position, Vector3.up); }
/// <summary> /// Rotates around the position of the VirtualTransform by the given amount of degrees on the Vector3.Up axis. /// </summary> /// <param name="virtualTransform">VirtualTransform whose position to rotate around.</param> /// <param name="angle">Degrees.</param> /// <param name="axis">Axis to rotate on.</param> public void RotateAround(VirtualTransform virtualTransform, float angle, Vector3 axis) { RotateAround(virtualTransform.Position, angle, axis); }
/// <summary> /// Applies the position, rotation, and localScale properties of the VirtualTransform to this VirtualTransform. /// </summary> /// <param name="virtualTransform">The VirtualTransform whose properties you want to apply to this VirtualTransform.</param> public void Apply(VirtualTransform virtualTransform) { this.Position = virtualTransform.Position; this.Rotation = virtualTransform.Rotation; this.LocalScale = virtualTransform.LocalScale; }
/// <summary> /// Constructs a VirtualTransform setting the position, rotation, and local scale to the values of the given VirtualTransform. /// </summary> /// <param name="virtualTransform">VirtualTransform whose properties you want to copy.</param> public VirtualTransform(VirtualTransform virtualTransform) { Position = virtualTransform.Position; Rotation = virtualTransform.Rotation; LocalScale = virtualTransform.LocalScale; }