Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Move SplineController in rhythm of song
#3
Hi,

Speed is either in world units or relative ones based on Move Mode
Position is based on Position Mode
More about this here: https://curvyeditor.com/documentation/controllers

I didn't get the logic behind the position computation, especially the lerping using deltaTime * 1000, but I will take your computation as it is, and give you how you should compute the speed:

Code:
float nextPosition = rhythmTool.currentFrame - InfiniteTrack.Instance.lengthCut;
float realNextPosition = Mathf.Lerp(Position, nextPosition, Time.deltaTime * 1000f);
float oldPosition = Position;
Speed = (realNextPosition - oldPosition) / Time.deltaTime;


This should do the work. Let me know if it doesn't.

To clarify why I don't like the lerping you did: it will make your game frame rate dependent. In other words, if your ship moves for a second at 30fps, or a second at 60 fps, the results will be different, because Lerp(Lerp(A,B,X),C,X) is different than Lerp(A,C,2*X)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
RE: Move SplineController in rhythm of song - by _Aka_ - 05-11-2019, 02:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can you move generated objects along spline? FernDigestive 1 8 04-02-2023, 12:14 PM
Last Post: _Aka_
  Feature Request-move UI elements in SceneView spawnstorm 5 20 09-17-2022, 12:37 PM
Last Post: _Aka_
Wink In SplineController OnPositionReachedList Event is missing shimizu 2 13 02-07-2022, 12:47 PM
Last Post: shimizu
  best way to rotate, change offset, and inset position of splinecontroller object smackledorf 1 24 01-17-2022, 01:39 PM
Last Post: _Aka_

Forum Jump: