예제 #1
0
        /// <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;
            }
        }
예제 #2
0
 /// <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));
 }
예제 #3
0
 /// <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));
 }
예제 #4
0
 /// <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);
 }
예제 #5
0
 /// <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);
 }
예제 #6
0
 /// <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);
 }
예제 #7
0
 /// <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;
 }
예제 #8
0
 /// <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;
 }