Titania X3D Editor

Bring Colours to Your Life.

Titania v4.6.10

Bring Colours to Your Life.

X3D Reference

Creating new node types


You can create new node types that encapsulate:

  • Shapes
  • Sensors
  • Interpolators
  • Scripts
  • anything else ...

This creates high-level nodes:

  • Robots, menus, new shapes, etc.

Syntax: PROTO

A PROTO statement declares a new node type (a prototype):

  • name - the new node type name
  • fields, inputs, and outputs - interface to the prototype

XML Encoding

Classic Encoding

Defining prototype bodies

PROTO defines:

  • body - nodes and routes for the new node type

XML Encoding

Classic Encoding

Syntax: IS

The IS syntax connects a prototype interface field, input, or output to the body:

  • Like an assignment statement
  • Assigns interface field or input to body
  • Assigns body outputs to interface

Interface items connected by IS need not have the same name as an item in the body, but often do:

XML Encoding

Classic Encoding

Using IS

May IS to ...

Interface initializeOnly inputOnly outputOnly inputOutput
initializeOnly yes no no yes
inputOnly no yes no yes
outputOnly no no yes yes
inputOutput no no no yes

Using prototyped nodes

The new node type can be used like any other type.

XML Encoding

Classic Encoding

Controlling usage rules

Recall that node use must be appropriate for the context:

  • A Shape node specifies shape, not color
  • A Material node specifies color, not shape
  • A Box node specifies geometry, not shape or color

The context for a new node type depends upon the first node in the PROTO body.

For example, if the first node is a geometry node:

  • The prototype creates a new geometry node type

The new node type can be used wherever the first node of the prototype body can be used.

A sample prototype use

Create a BouncingBall node type that:

  • Builds a beachball
    • Creates an animation clock
    • Using a PROTO field to select the cycle interval
  •  Bounces the beachball
    • Using the bouncing ball program script
    • Using a PROTO field to select the bounce height

Fields needed:

  • Bounce height
  • Cycle interval

XML Encoding

Classic Encoding

Inputs and outputs needed:

  • None - a TimeSensor node is built in to the new node

Body needed:

  • A ball shape inside a transform
  • An animation clock
  • A bouncing ball program script
  • Routes connecting it all together

XML Encoding

Classic Encoding

Changing a prototype

If you change a prototype, all uses of that prototype change as well

  • Prototypes enable world modularity
  • Large worlds make heavy use of prototypes

For the BouncingBall prototype, adding a shadow to the prototype makes all balls have a shadow.


Prototypes are typically in a separate external file, referenced by an EXTERNPROTO

  • name, fields, events - as from PROTO, minus initial values
  • url - the URL of the prototype file
  • #name - name of PROTO in file

XML Encoding

Classic Encoding


  • PROTO declares a new node type and defines its node body
  • EXTERNPROTO declares a new node type, specified by URL

Cookies and other Technologies

By clicking »Accept« or continuing to use the site, you agree to the use of CREATE3000 and third-party cookies and other similar technologies to enhance your browsing experience, analyze and measure your engagement with our content, and provide more relevant ads on CREATE3000 websites and others. Learn more about cookies. You can withdraw your consent at any time.

create3000.de is going to be shut down next year, but we have a new clean and slick web site for you, go to new X_ITE web site, consider updating your X_ITE URL's, or go to new Titania web site or continue reading.