Class AgentConsultant2

  extended byScript
      extended byAgentConsultant2

public class AgentConsultant2
extends Script

This class handles the collision detection for the scene. You will have to create a new controller for every scene that contans differnt objects. VRML supplies no object-to-object collision detection so this is based on a object to object basis Step 1 - get a reference to the objects in the scene you need to check and the object you are checking against Step 2- Get the translations of the objects you want to check Step 3- Get a reference to the enviromental agent so you can get access to agent consultant Step 4- Check the distance, if they are touching if they are send the obstacle to the agent consultant Step 5 - apply the action that is returned from agent consultant

See Also:
Serialized Form

Constructor Summary
Method Summary
 double distance(float pointx1, float pointx2, float pointy1, float pointy2)
 void initialize()
          This method intialized all the parameters.
 void processEvent(Event e)
          This method does the work of the class.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public AgentConsultant2()
Method Detail


public void initialize()
This method intialized all the parameters. Gets a reference to the enviromental agent and the parameters passed in from applet



public void processEvent(Event e)
This method does the work of the class. First you get the translation and scale of the object you want to check. Get the translation of the obstacles. Check thier distances, if touching call the agent consultant and determine what action to take. Then apply the action



public double distance(float pointx1,
                       float pointx2,
                       float pointy1,
                       float pointy2)