algorithmic modeling for Rhino


I have a working animation in grasshopper, but what i want is to move the camera, for example like a 360 turntable or more like a real cam, on a curve (zooming in and out, and turning cam around object). Is there any solution? Any VB or C# thing?
My dream solution is a parameterised curve (a loop) that comes in a VB or C# component as an input, a 3D point as an other input, and while the animation is rendering the camera will go through the input curve and watching to the point.. but maybe you have some cooler ideas:)


Views: 2130

Replies to This Discussion

It's pretty simple actually. Create a component with the following code:

Dim viewport As MRhinoViewport = app.ActiveView.activeviewport
viewport.SetTargetAndCameraLocation(x, y)

The 'x' input is the target point, so input a point to rotate around. The 'y' input is the camera point, you can create a circle (or a fancy spline path), then connect it to a length curve component with a slider and input the resulting point to the 'y' input. Changing the slider value will rotate the camera around 'x'. This will change the camera/target of the active viewport, so remember have the perspective viewport as active.

Thanks a lot, that was pretty easy, as you said. Probably you saved my life..
Thx again,

Well, sorry for bothering you again, but is there any solution for adding lights like this? (two point: one is where the light is, the other one is where it is lightning to) because I made this turntable thing, and all the lights are gone, i mean there are no shadows anymore.. My thought is that maybe the viewport "changing" makes this, so if i create a light in a VB component, it will be fine... what do you think?

vicente - does this code still work with the latest version of grasshopper?


i setup a componenet but nothing happens with your instructions - i've made sure perspective is active.


please let me know!



This is a very old thread. You can still use old code using the legacy VB.NET component.

The modern code to achieve the same thing is:

doc.Views.ActiveView.ActiveViewport.SetCameraLocations(x, y)

Hi Peter,

Have you used horster before? I think that may serve what you want.

You can adjust the location of camera, target point & lens length from within gh. You may put a slider to evaluate the camera path to a point and set it as the camera location.








© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service