i wanna scriptt for cinemachine splines i wanna simulate physicly like movement object…
- User
i wanna scriptt for cinemachine splines
i wanna simulate physicly like movement object here but no rigidbod use
but have colldirs
rigidbody may be but is kinematic and no gravity
i wanna controll with bool that train moving obejct
if bool true - then no input - trains moves with given speed also not typically move, its must have aniamtion curve to gain with timee his speed
i mean for example if varaible quick of speed = 0 and htne suddny equal to 100 train must not het that speed immidiatly its must slowly bery slow gain that quick
also if bool equal to false then userr able to controll train by input keycode down W and keycode up samee
okk?
also i wanna onenable void with random changing speed of that train if bool = true
its must random range on enable coroutine start
in that coroutine randmo range 10-900 must call again same onenable void in the end of coroutine that coroutine must wait ilike wrote 10-900 seconds - and main part - he must change quick speed of train randomly between vraible Vector2 that = 10-190 if bool = false
- Assistant
- User
can u add here cinemachine splines movement? that train follow splines path?
i can change cinemachine splines to othe packages, but mostly iits bunch of points in circlee
- Assistant
- User
okk, whats accelerationCurve values i need for maximum visualization of effect very slow gain of speed?
can u write only 1 line with equal varible i mean public accelerationCurve= here values of propertie by default
- Assistant
To define an
AnimationCurvein code that gives the effect of a very slow gain of speed, you can set its values so it starts off gently and gradually ramps up. The curve would typically be very flat at the beginning and slowly increase towards the end.Here's a single line that initializes the
accelerationCurvewith a suitableAnimationCurve:csharppublic AnimationCurve accelerationCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);Explanation:
- EaseInOut: This creates a curve that starts off slow, accelerates in the middle, and then slows down at the end. For your needs, it's natural to use this with slight modification if needed.
- (0f, 0f, 1f, 1f): Starts at time 0 with value 0 and ends at time 1 with value 1, which represents a full smooth transition from start to finish.
Customization:
- If you want to slow the beginning even more, consider modifying the curve by using keyframes or adjusting the tangents manually, but the above gives a standard ease-in effect suitable for most cases.