Creating other types of Environmental Agents


1. Place the agent container in the VRML Scene. This container can be controlled using the translation and scale fields of the container either by manually editing the fields or using a JAVA program.

2. Replace the wildfire animation with the animation of your choice (See the asteroid example here Asteroid) (Example 1)

3. In the agent dispatcher script node set the correct URL for the java class that handles your agent’s movement. All types of environmental agents have different factors that influence their movement. Hence you have no choice but create this class using the tools provided. See the JAVA API for what tools are there. (Example 2)

4. Ensure the URL field of this script node points to the correct Agent Consultant class for your scene and that you have references to the objects in the scenes you want to check for collisions. (Example 3)

Example 1. Replace the animation

#####################################################################################################################
# Define the box that holds enviromental graphic
#####################################################################################################################


Transform{
rotation 1 0 0 1.57

children [
DEF Agent_Container Transform {

rotation 1 0 0 -1.57
translation 163.81705 -138.32748 13.0

children [
Billboard{

children [
DEF agent Shape {
appearance Appearance {texture DEF _MovieTexture MovieTexture {
loop TRUE
url "flame5.gif" <---------- Here is where you place your environmental graphic
}}

geometry IndexedFaceSet {
coord Coordinate {point [-1 -1 0,1 -1 0,1 1 0,-1 1 0]}
normalPerVertex FALSE
texCoord TextureCoordinate {point [0 0,
1 0,
1 1,
0 1,
]}

coordIndex [ 0, 1, 2, 3, -1]}
} # end Shape
] # end children
} # end billboard
] #end billboard children
} # end cone

DEF ps PlaneSensor{
offset 163.81705 -138.32748 13.0
enabled TRUE

} # end planeSensor


] # end children


} # end group

Example 2. Ensuring the correct Agent Consultant

#####################################################################################################################
# This is the script that determines the movent ofthe agent
#####################################################################################################################

DEF Agent_Dispatcher Script {
directOutput TRUE
field SFNode node USE Agent_Container
field SFFloat windspeed 0
field SFFloat winddirection 0
field SFFloat moisture 0
field SFString scenetype "lightlogging"
url "AgentDispatcher.class" <----------- field that needs to point to your agent dispatcher java interface class.
eventIn SFFloat start
eventIn SFVec3f params

field SFBool firstime TRUE
eventOut SFBool moveable

eventOut SFVec3f scale_changed


Example 3. Ensuring the Agent Consultant is pointing to the correct Java Class

#####################################################################################################################
# The script that handles the object to object collision detection for VRML
#####################################################################################################################

# This is an abridged version for example purposes

DEF Agent_Consultant Script {
directOutput TRUE
# objects in the scene you want to check if they are collideded with. In this case its trees.


field SFNode collide1 USE dad_Group03 <------- Object in the scene you want to check for a collision
field SFNode collide2 USE dad_Group04


#objects you want to replace with when a collision occurs


field SFNode burnt_tree2 USE burnt2 <----- Object you want to replace with on event of collision (optional)
field SFNode burnt_tree3 USE burnt3

* objects you want to replace with when it is collided with

field SFNode node USE Agent_Container
field SFNode bt USE Burning_Tree


eventOut SFBool start_ani
eventOut SFVec3f fire_translation
url "AgentController.class" <----- Here is the user that should be pointing to the correct agent_consultant interface for the scenetype
eventIn SFFloat start

}