09-20-2024, 04:20 PM
Hi,
Found the cause of your issue. It is unrelated to Curvy Splines.
Your issue is that you compute the velocity from previous frame, and apply it to your capsule on the current frame. So you will have a delay. This delay, when the platform reaches the end of the spline and comes back, is translated as a "jitter" between the platform and the capsule.
Here is a fixed version of your code:
Important point, make sure your script executes before the spline controller. (see Project Settings -> Script Execution Order).
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Found the cause of your issue. It is unrelated to Curvy Splines.
Your issue is that you compute the velocity from previous frame, and apply it to your capsule on the current frame. So you will have a delay. This delay, when the platform reaches the end of the spline and comes back, is translated as a "jitter" between the platform and the capsule.
Here is a fixed version of your code:
Code:
using FluffyUnderware.Curvy.Controllers;
using UnityEngine;
public class TestSplinePlatform : MonoBehaviour
{
public Rigidbody rb;
public SplineMovingPlatform splinePlatform;
private void FixedUpdate()
{
Vector3 platformVelocity = GetPlatformVelocity();
rb.velocity = platformVelocity;
}
private Vector3 GetPlatformVelocity()
{
float speed;
{
speed = splinePlatform.controller.Speed;
if (splinePlatform.controller.MovementDirection == MovementDirection.Backward)
speed *= -1;
}
return splinePlatform.controller.Spline.GetTangent(splinePlatform.controller.RelativePosition) * speed;
}
}Important point, make sure your script executes before the spline controller. (see Project Settings -> Script Execution Order).
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.

