Example #1
0
 /// <summary>
 ///  Used when you can't depend on Update() to automatically update CurrentParabolaAngle
 /// (for example, directly after enabling the component)
 /// </summary>
 public static float3 ForceUpdateCurrentAngle(CurveTeleporterCalculations pointerCalculations, Vector3 velocity)
 {
     //Vector3 velocity = e.PointerObjects.transform.TransformDirection(PointerCalculations.InitialVelocity);
     pointerCalculations.CurrentParabolaAngleY = ClampInitialVelocity(ref velocity, out float3 d);//, PointerCalculations.InitialVelocity);
     pointerCalculations.CurrentPointVector    = d;
     return(velocity);
 }
Example #2
0
        /// <summary>
        /// Calculate the points on the way of the Parabola
        /// </summary>
        /// <param name="e">The reference to the entity to check</param>
        /// <param name="velocity">The velocity of the Parabole</param>
        /// <returns>The normal of the Curve</returns>
        public static float3 ParabolaPointsCalculations(ref NativeArray <Translation> pp, ref CurveTeleporterCalculations ctc, ParabolPointsParameters ppp, TeleportNavMesh tnm, float3 parabolOrigin, LayerMask excludedLayer, Vector3 velocity)
        {
            ctc.PointOnNavMesh = CalculateParabolicCurve
                                 (
                parabolOrigin,
                velocity,
                ctc.Acceleration,
                ppp.PointSpacing,
                ppp.PointCount,
                tnm,
                excludedLayer,
                out pp,
                out float3 normal,
                out ctc.LastPointIndex,
                out bool onTeleportableLayer
                                 );

            ctc.PointOnTeleportableLayer = onTeleportableLayer;
            ctc.PointToGoTo = pp[ctc.LastPointIndex].Value;
            return(normal);
        }