SceneGraph

Home About XEngine Engine API SceneGraph Changelog Programming Guide

Index

| Scene Description Language | camera | directory | eventmessage | geometry | group | input | light | node | primitives | root | spinner | transformation | user |

User

Derived from: TransformNode3D
Class name: User3D
Description: This type of node implements an autonomous entity that can navigate through the virtual world as a result of a controller that provides input and therefore drives the node. User is not a unique node; many users may populate the virtual world, each one representing a different actual user (e.g. for multiplayer games) or computer-controlled characters, animals or avatars in general. The user nodes do not implement a viewing system, as this is part of the camera node, which of course can be bound ( attached) to any scene graph node, including a user. Cameras and users are completely different entities in the SceneGraph API, allowing a large diversity of configurations, multiple angles, multiple users and any dynamic combination of them. User is derived from the transformation node type, which means that it can therefore contain other nodes. This makes the addition of a visual representation of the avatar very easy, as you only add whatever node you want as the content of the user and it will move along with it.

Function List

Name XE_user_set_position
Arguments int node_id, float x, float y, float z
Return Type bool
Description Sets the user's position

Parameters:
- node_id, the node's id
- x, the x value of the position vector in world coordinates (Default value is 0.0)
- y, the y value of the position vector in world coordinates (Default value is 0.0)
- z, the z value of the position vector in world coordinates (Default value is 10.0)

Returns true if the node id was found
Notes:  

Name XE_user_get_position
Arguments int node_id, float& x, float& y, float& z
Return Type bool
Description Retrieves the user's position

Parameters:
- node_id, the node's id
- x, the x value of the position vector in world coordinates
- y, the y value of the position vector in world coordinates
- z, the z value of the position vector in world coordinates

Returns true if the node id was found
Notes:  

Name XE_user_set_target
Arguments int node_id, float x, float y, float z
Return Type bool
Description Sets the user's target point

Parameters:
- node_id, the node's id
- x, the x value of the target vector in world coordinates (Default value is 0.0)
- y, the y value of the target vector in world coordinates (Default value is 0.0)
- z, the z value of the target vector in world coordinates (Default value is -1.0)

Returns true if the node id was found
Notes:  

Name XE_user_get_target
Arguments int node_id, float& x, float& y, float& z
Return Type bool
Description Retrieves the user's target point

Parameters:
- node_id, the node's id
- x, the x value of the target vector in world coordinates
- y, the y value of the target vector in world coordinates
- z, the z value of the target vector in world coordinates

Returns true if the node id was found
Notes:  

Name XE_user_set_linear_speed
Arguments int node_id, float lsp
Return Type bool
Description Sets the speed at which the user rotation is updated

Parameters:
- node_id, the node's id
- asp, the angular speed (Default value is 1.0)

Returns true if the node id was found
Notes:  

Name XE_user_get_linear_speed
Arguments int node_id, float asp
Return Type bool
Description Retrieves the user's angular speed

Parameters:
- node_id, the node's id
- asp, the angular speed

Returns true if the node id was found
Notes:  

Name XE_user_set_angular_speed
Arguments int node_id, float x, float y, float z
Return Type bool
Description Sets the user target

Parameters:
- node_id, the node's id
- x, the x value of the target vector in world coordinates (Default value is 0.0)
- y, the y value of the target vector in world coordinates (Default value is 0.0)
- z, the z value of the target vector in world coordinates (Default value is -1.0)

Returns true if the node id was found
Notes:  

Name XE_user_get_angular_speed
Arguments int node_id, float& asp
Return Type bool
Description Retrieves the user target

Parameters:
- node_id, the node's id
- x, the x value of the target vector in world coordinates
- y, the y value of the target vector in world coordinates
- z, the z value of the target vector in world coordinates

Returns true if the node id was found
Notes:  

Name XE_user_attach_to_input_node
Arguments int user_node_id, int input_node_id
Return Type bool
Description Attaches the user node to an input node, so that the user is updated based on input (keyboard, mouse, joystick, etc.)

Parameters:
- user_node_id, the user's node's id
- input_node_id, the input's node's in

Returns true if both nodes' ids were found
Notes:  

Name XE_user_attached_to_input_node
Arguments int user_node_id, int& input_node_id
Return Type bool
Description Retrieves the input node id this user is attached to

Parameters:
- user_node_id, the user's node's id
- input_node_id, the input's node's in

Returns true if both nodes' ids were found, otherwise input_node_id is set to -1
Notes:  

 

Scene Description Language Declaration

XML node name user
Placement: Anywhere
Description: This type of node implements an autonomous entity that can navigate through the virtual world as a result of a controller that provides input and therefore drives the node. User is not a unique node; many users may populate the virtual world, each one representing a different actual user (e.g. for multiplayer games) or computer-controlled characters, animals or avatars in general. The user nodes do not implement a viewing system, as this is part of the camera node, which of course can be bound ( attached) to any scene graph node, including a user. Cameras and users are completely different entities in SceneGraph, allowing a large diversity of configurations, multiple angles, multiple users and any dynamic combination of them. User is derived from the transformation node type, which means that it can therefore contain other nodes. This makes the addition of a visual representation of the avatar very easy, as you only add whatever node you want as the content of the user and it will move along with it.
Special notes: Although derived from a transformation node type, all direct transformation messages are ignored.
Inherited attributes: name, active, visible
New attributes:
attribute type description
input STRING Declares the input node that will provide all control for the user.
position VEC3 The initial position of the user. Default value is (0,0,10).
lookat VEC3 Where the user initially points to. Default value is (0,0,-1).
target VEC3 Same as lookat.
linear_speed FLOAT The linear speed of the user in world units. Default value is 3.0.
angular_speed FLOAT The angular speed of the user in world units. Default value is 1.0.
Events:
event name condition
moveforward Issued when the user moves forward. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
movebackward Issued when the user moves backward. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
moveleft Issued when the user moves (strafes) left. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
moveright Issued when the user moves (strafes) right. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
tiltup Issued when the user front direction tilts toward its "up" vector. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
tiltdown Issued when the user front direction tilts away from its "up" vector. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
turnleft Issued when the user front direction turns away from its "right" direction vector. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
turnright Issued when the user front direction turns toward its "right" direction vector. Ideal for changing in the appearance of the user when performing this action. This is independent of the input control type.
Inherited events: -
New messages:
attribute value description
input STRING Declares the input node that will provide all control for the user.
position VEC3 The initial position of the user. Default value is (0,0,10).
lookat VEC3 Where the user initially points to. Default value is (0,0,-1).
target VEC3 Same as lookat.
linear_speed FLOAT The linear speed of the user in world units. Default value is 3.0.
angular_speed FLOAT The angular speed of the user in world units. Default value is 1.0.
Inherited messages: active, visible, hide, show, deactivate, enable, activate, disable
Redefined messages: -
Obsolete messages: translation, scale, rotation

Example

<world ambient="0.3 0.3 0.3" background="0.2 0.2 0.2">
   
    <camera name="first_person" aperture="50.0"
            near="2.0" far="1000" follow="Myself" primary="true">
    </camera> 

    <transformation name="environment" scale="1.0,1.0,1.0" translation="0,0,-10">
        
        <object name="geom1" file="arena.obj"></object>
    
    </transformation>
 
    <user name="Myself" control="navigate" linear_speed="2.0" angular_speed="0.5
          position="0,50,50" target="0,0,-10" input="MouseKeyboard">
    </user>

    <input name="MouseKeyboard" devicename="device0">
    </input>
    
</world>

Last updated: 3 Jun. 2013