Set Navigations and Viewpoints by using X3DOM Runtime API

This is the simple example code of setting navigations and viewpoints by using X3DOM Runtime API.

function setRuntime(typename, id)
	/* ====================================================
	 Arguments:	typename (string) -
	 To change mode or viewpoint.
	 walk() : Switches to walk mode.
	 examine() : Switches to examine mode.
	 lookAround() : Switches to lookAround mode.
	 lookAt() : Switches to lookAt mode.
	 resetView() : Navigates to the initial viewpoint.
	 uprightView() : Navigates to upright view.
	 showAll() : Zooms so that all objects are visible.
	 nextView() : Navigates to the next viewpoint.
	 prevView() : Navigates to the previous viewpoint.
	 Returns: The current mode or viewpoint.
	 Set mode or viewpoint of X3DOM element.
	 ==================================================== */
	var configure = document.getElementById(id);
	switch (typename)
		case "walk": configure.runtime.walk(); break;
		case "fly":; break;
		case "examine": configure.runtime.examine(); break;
		case "lookAround": configure.runtime.lookAround(); break;
		case "lookAt": configure.runtime.lookAt(); break;
		case "game":; break;
		case "resetView": configure.runtime.resetView(); break;
		case "uprightView": configure.runtime.uprightView(); break;
		case "showAll": configure.runtime.showAll(); break;
		case "nextView": configure.runtime.nextView(); break;
		case "prevView": configure.runtime.prevView(); break;
		case "upSpeed": setSpeed("up", id); break;
		case "downSpeed": setSpeed("down", id); break
		default: configure.runtime.examine();

And the experiment.

For more information about X3DOM Runtime API see:

One Comment Add yours

  1. You’ve got brought up a quite good details, regards for the post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s