Vehicle Animation

I am trying to animate the movement of vehicles over a path over time.

To do this, I’d need to keep something like a database of all vehicles containing their location, speed, acceleration and route for each vehicle and interpolate over time. The idea is to run a periodic script updating the position of each vehicle every, say, 1000 ms.

The data would internpolate from previous time increment to calculate new location/speed/acceleration. I have prepared a draft python node that would calculate new values between the two time increments.

The problem I have is that I am not sure where to store this data. If I try to keep it in a list and feed the output back into the input of the python node I get a cyclic reference! My other idea is to convert the data into a text element inside revit, and then convert the data back into a list and feed it into the function.This doesn’t work also. It would appear that once periodic running is enabled, ModelText.Text only reads the text once and doesn’t bother to update from Revit on subsequent periodic runs.

The only solution I can think of is to pre-calculate the position of all vehicles over time and then animate over this pre-prepared database of positions/times. But the I’d lose the interactivity of updating input data in real time (e.g. time in stop or max acceleration).

Any ideas how this could be achieved? Or is Dynamo/revit/python a completely wrong tool to attempt to do this?

1 Like

I think to save in external source like excel or text file it will work. and I am interested to see the results

Hi @nesovic,

I have no experience with this, but i thought the link below was worth mentioning.
http://therevitcomplex.blogspot.nl/2017/01/learn-how-to-make-your-revit-families.html

Kind regards,
Mark

Yes, by the looks of it the only option would be to split the dynamo script into two. One for generating paths over time and one for animating the pre-calculated paths.

To investigate the different inputs, I’d need to generate new data, save to file then animate it. Not ideal, but looks like it should work!

This is entriely possible within Dynamo, with incremental parameter adjustment for creating multiple instances of a representative vehicle along a path. But, alternative softwares can provide what you are after out of the box, with sample vehicle databases.

Have you looked at Autodesk Vehicle Tracking? Its got some awesome features.

Or a free alternative with more limited functionality?
http://www.glamsen.se/CadTools.htm

Any exported data from these softwares can, in turn, be interpreted by Dynamo for additional geometry creation. Good luck! :slightly_smiling_face:

I am big fan of both cadtools and autotrack :slight_smile:

But I am looking at a slightly larger scale here and want to animate vehicles (as dots) along a 10km route :slight_smile: I suppose I should have explained myself better.

Pre-calculating positions along the entire route for each vehicle plotted as a function of time seems to be the way to go rather than doing it on-the-fly!

Will try to update over the coming weeks unless I hit a dead-end with dynamo at some stage and lose interest! Clearly revit/dynamo are not ideal tools for this but I don’t fancy trying to program everything including displaying all this stuff on a map from scratch!!! At least with Revit I should be able to get the display side of things done quickly once I figure out the maths!!

1 Like

OK, so it is feasible. The chainages need to be pre-calculated rather than iterated over time. Then use the Counter add-in by Daniel_Woodcock1 to animate.Please see the link below. It should be also possible to use the Web Request node and then save the iterations to an external file as suggested by Dimitar Venkov.

https://forum.dynamobim.com/t/how-to-generate-an-input-to-vary-over-time/3170/8

For the end result please see the video below:

https://markomarko.tinytake.com/sf/MjM2MzgwMV83MjAwMjU0

The python node is currently very basic - just simple slowing down before the stop and accelerating afterwards…

Now to animate over a real route, add more vehicles, add vehicle interactions… calculate capacity :slight_smile: the fun part…

1 Like

Just a follow-up if anyone’s interested. Final animations here:

3 Likes