- Home /
Problem employing movement behaviour using a flow-field table
I am trying to employ a flow-field movement behaviour according to the following video: https://youtu.be/BjoM9oKOAKY
My desired result should look like the one at the time 23: 54 in the video.
To sum up, I am given a matrix that stores vectors generated using Perlin Noise 2D. In my matrix, these vectors have the X, Z values (because I am working in a 3D object and I do not need the Y-axis) mapped between the interval (-1,1) . I get therefore the following result:
Having this flow-field, I am going to throw an object at a random position on it, and this object has to move according to the vector of the tile that the object finds itself above. Basically, I am describing a range of routes that the object can take and follow.
I have already written the function that retrieves the correspondent vector at a given position of the object, but how could I write the movement function, so that the velocity of the object is according to the vectors in the tiles under it? Any script suggestions or examples?
The velocity of the object does not have to exceed a maxVelocity and if possible and if necessary in this case, the object should employ a steering behaviour. My goal is that the movement of this object is smooth as in the aforementioned video. I have already tried to translate the script from the video in C#, but when I spawn the object on the table, its velocity keeps increasing until maxVelocity and moves in an unique manner unaccordingly to the vectors pointing in a specific direction.