07-25-2023, 10:33 PM
Hi
I modified the class to implement a simple slope induced speed:
I hope this helped
Have a nice day
I modified the class to implement a simple slope induced speed:
Code:
public class E10_MotorController : SplineController
{
[Section("Motor")]
public float MaxSpeed = 30;
public float SlopeFactor = 10;
protected override void Update()
{
float axis = Input.GetAxis("Vertical");
float slopeInducedSpeed = Mathf.Abs(GetTangent(RelativePosition).y) * SlopeFactor;
Speed = Mathf.Abs(axis) * MaxSpeed + slopeInducedSpeed;
MovementDirection = MovementDirectionMethods.FromInt((int)Mathf.Sign(axis));
base.Update();
}
}
I hope this helped
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.