Hi all!
I’m using a C# script to automate the setting of camera location and target using:
RhinoDocument.Views.ActiveView.ActiveViewport.SetCameraLocations(camTarget, camPosition);
IS there a similar command to set the rotation with respect to the axis defined by the vector created by camTarget and camPosition?
Yes, I’m!
Unfortunately, I’m not very good at C# and I’m not able to make it work using a C# component in grasshopper which gets the location, target, and rotation as its input.
The following is the code I found online:
using System;
using System.Collections;
using System.Collections.Generic;
using Rhino;
using Rhino.Geometry;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
using System.IO;
using System.Linq;
using System.Data;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
using System.Runtime.InteropServices;
using Rhino.DocObjects;
using Rhino.Collections;
using GH_IO;
using GH_IO.Serialization;
public class Script_Instance : GH_ScriptInstance
{
private void RunScript(Point3d camPosition, Point3d camTarget, ref object A)
{
RhinoDocument.Views.ActiveView.ActiveViewport.SetCameraLocations(camTarget, camPosition);
}
}
It’d be awesome if you could suggest a line of code to add to this to achieve camera rotation for the C# component.