Camera Animation Creation by Script

i’m trying to create a flythru animation with Bongo, and i already have seriese of camera position and target points in csv.
instead of making keyframe manually, i tried to do it by RhinoScript.
following script fails to function as i want to where i hoped that moving the camera position while Animate isEnabled will create a keyframe.

can anyone give me some advice??

Rhino.Command "BongoSetCurrentTick 0"
While Not objFile.AtEndOfStream
	strLine = objFile.ReadLine
	arrData = split(strLine, ",")
	Rhino.Command "BongoAnimate e _Enter"
	Rhino.ViewCameraTarget strTargetView, Array(arrData(0), arrData(1), arrData(2)), Array(arrData(3), arrData(4), arrData(5))
	Rhino.ViewCameraUp strTargetView, Array(arrData(6), arrData(7), arrData(8))
	Rhino.Command "BongoAnimate e _Enter"
	Rhino.Command "BongoSetCurrentTick i _Enter"

I tried a simple script similar to yours since I don’t have the data file. It seemed to work alright. Here’s my code:

Rhino.Command "BongoSetCurrentTick 0"
Rhino.Command "BongoAnimate e _Enter"
Rhino.Command "BongoSetCurrentTick 25 _Enter"
Rhino.ViewCameraTarget "Perspective", Array(0, 0, 0), Array(0, 100, 0)
Rhino.ViewCameraUp "Perspective", Array(0, 0, 1)

Did you enable animation for the viewport? You do this by right clicking the view in the animation manager and clicking “Animation Enabled.” It should look like this when you’re done.


If animation for the view is not enabled the keyframes will not be created. You can also read more about animating views here.

Thank you so much Joshua.
so it SHOULD work.
for some reason it doesn’t in my place…
if anyone can test it with these files, it’ll be great.
when you run the script, it will prompt to select a txt file and i am attaching that as well.
render camera action with Octane.rvb (1.9 KB)
test2_take7_202051015.txt (128.9 KB)
this is the video how it works in my computer.

So there’s some issues with Bongo that make your script not work. It has to do with how Bongo listens to viewport updates. A better way to pass this data to Bongo would be via the BongoAddKeyframe command. What I do is build one large command with all the keyframe data then run that command. It may take awhile to run but hopefully this accomplishes what you want.

ParseKeyframes.rvb (1.7 KB)

thank you so much for your help.
it certainly accomplishes what me want!!
i wasn’t using BongAddKeyframe command just because i didn’t want to do Up vector to Rotation conversion.

this was just for my experimental project (below), but possibly in the future, i’d use the script in the real project.

thanks again, for your time!