Trajectory of grenade stopped working

The trajectory curve I placed on my grenade is not registering. Everything else works great but My grenades go straight although my curve is set correclty. when I change the curve nothing registers. is their a quick fix for this?

Can you show us your code?

for what its worth, i converted to use math instead of the curve control…

// simple math for an arc that goes from 1 to 1 on x and y
        public static float
        Parabla(
            float maxHeight,
            //0-1 over time... this is x
            float percentTraveled,
            // allows starting a bit higher... 0.2f is waist high
            float startHeightFactor = 0f
        )
        {
            return maxHeight *
            (
            -Mathf
                .Pow((
                (percentTraveled * (2f - startHeightFactor)) -
                (1f - startHeightFactor)
                ),
                2) +
            1
            );
        }

used as:

Vector3 moveDirection = (targetPosition - positionXZ).normalized;
            positionXZ += moveDirection * moveSpeed * Time.deltaTime;
            float distance = Vector3.Distance(positionXZ, targetPosition);
            float positionY =
                Explosion
                    .Parabla(totalDistance / 4f,
                    1 - (distance / totalDistance),
                    0.33f);

            transform.position =
                new Vector3(positionXZ.x, positionY, positionXZ.z);

Privacy & Terms