Toggle Realism in .NET API

By Xiaodong Liang

.NET API has not exposed the abilities to allow you to toogle Realism, but in COM API, there are relevant objects which could help. They are:
– InwNvViewer.Gravity: toggle gravity
– InwNvViewer.CollisionDetection : toggle collision detection.
– InwNvViewer.AutoCrouch:toggle auto crouch
– InwNvViewer.CameraMode: specify the mode is first person or third person

image

The following is a small code snippet.

using COMBridge = Autodesk.Navisworks.Api.ComApi.ComApiBridge;

using COMApi = Autodesk.Navisworks.Api.Interop.ComApi;

 

void toogleRealism()

{    

COMApi.InwNvViewPoint2 oV =

(COMApi.InwNvViewPoint2)COMBridge.State.CurrentView.ViewPoint;

//third person

oV.Viewer.CameraMode =

COMApi.nwECameraMode.eCameraMode_ThirdPerson;      

 

    if (oV.Paradigm == COMApi.nwEParadigm.eParadigm_WALK)

    {

        // gravity, coollison or crouch can only take effect in Walk mode.

        oV.Viewer.Gravity = true;//toogle gravity on

        oV.Viewer.CollisionDetection = true;//toogle collision detection on

        oV.Viewer.AutoCrouch = true; //toogle auto crouch on

    }

}

 

<blockquote style="margin-right: 0px" dir="ltr"></blockquote>

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading