예제 #1
0
 /// <summary>
 /// Performs tranformation of the given point in local space to world space.
 /// </summary>
 /// <param name="transformComponent">The transform component.</param>
 /// <param name="point">Local space point.</param>
 /// <returns>World space point.</returns>
 public static Vector3 LocalToWorld(this TransformComponent transformComponent, Vector3 point)
 {
     Vector3 result;
     Vector3.Transform(ref point, ref transformComponent.WorldMatrix, out result);
     return result;
 }
예제 #2
0
 /// <summary>
 /// Performs tranformation of the given point in world space to local space.
 /// </summary>
 /// <param name="transformComponent">The transform component.</param>
 /// <param name="point">World space point.</param>
 /// <param name="result">Local space point.</param>
 public static void WorldToLocal(this TransformComponent transformComponent, ref Vector3 point, out Vector3 result)
 {
     Matrix worldMatrixInv;
     Matrix.Invert(ref transformComponent.WorldMatrix, out worldMatrixInv);
     Vector3.Transform(ref point, ref worldMatrixInv, out result);
 }
예제 #3
0
 /// <summary>
 /// Performs tranformation of the given point in local space to world space.
 /// </summary>
 /// <param name="transformComponent">The transform component.</param>
 /// <param name="point">Local space point.</param>
 /// <param name="result">World space point.</param>
 public static void LocalToWorld(this TransformComponent transformComponent, ref Vector3 point, out Vector3 result)
 {
     Vector3.Transform(ref point, ref transformComponent.WorldMatrix, out result);
 }
예제 #4
0
        private bool RecurseCheckChildren(FastCollection <TransformComponent> children, TransformComponent targetTransform)
        {
            foreach (var transformComponentChild in children)
            {
                if (transformComponentChild.Parent == null)
                {
                    continue;                                         // skip this case, the parent has not updated it's list yet
                }
                if (!RecurseCheckChildren(transformComponentChild.Children, targetTransform))
                {
                    return(false);
                }

                if (targetTransform.Entity.Id != transformComponentChild.Entity.Id)
                {
                    continue;
                }

                return(false);
            }
            return(true);
        }