public class Raycasting extends SensomotoricModule<UT2004Bot>
AutoTraceRay that is being utilized).
It is designed to be initialized inside IUT2004BotController.initializeController(UT2004Bot) method call
and may be used since IUT2004BotController.botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)
is called.
act, worldViewagent, controller, eventBus, log| Constructor and Description |
|---|
Raycasting(UT2004Bot bot) |
Raycasting(UT2004Bot bot,
Logger log) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIfAllInited()
Sets
allRaysInitialized flag to true if all rays has been initialized. |
protected void |
cleanUp() |
void |
clear()
Deletes all previous rays and makes this instance ready for setting up
new rays.
|
Future<AutoTraceRay> |
createRay(String Id,
javax.vecmath.Vector3d Direction,
int Length,
boolean FastTrace,
boolean FloorCorrection,
boolean TraceActors)
Initializes ray usind AddRay command and returns future that waits for
the first AutoTraceRay message corresponding to this ray.
|
Future<AutoTraceRay> |
createRay(javax.vecmath.Vector3d Direction,
int Length,
boolean FastTrace,
boolean FloorCorrection,
boolean TraceActors)
Creates ray with system generated id.
|
void |
endRayInitSequence()
Once all rays were initialized using createRay(...) methods, call this
method to start listening for response from UT.
|
cz.cuni.amis.utils.flag.Flag<Boolean> |
getAllRaysInitialized() |
AutoTraceRay |
getRay(String rayID)
Returns a ray of specified id.
|
getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toStringpublic Raycasting(UT2004Bot bot)
public cz.cuni.amis.utils.flag.Flag<Boolean> getAllRaysInitialized()
protected void cleanUp()
cleanUp in class AgentModule<UT2004Bot>public void clear()
throws CommunicationException
CommunicationExceptionpublic void endRayInitSequence()
public Future<AutoTraceRay> createRay(String Id, javax.vecmath.Vector3d Direction, int Length, boolean FastTrace, boolean FloorCorrection, boolean TraceActors) throws CommunicationException
Id - User set Id of the ray, so the ray can be identified.Direction - Vector direction of the ray (it will be relative - added to
the vector, where the bot is looking, also takes into
account angle of the floor the bot is standing on).Length - Specifies the length of the ray (in UT units).FastTrace - True if we want to use FastTrace function instead of Trace
function (a bit faster but less information provided - just
information if we hit something or not).FloorCorrection - If we should correct ray directions accoring floor normal. Note: Has issue - we can't set set rays up or down when correction is active.TraceActors - If we want to trace also actors – bots, monsters, players,
items. False if we want to trace just level geometry.CommunicationExceptionpublic Future<AutoTraceRay> createRay(javax.vecmath.Vector3d Direction, int Length, boolean FastTrace, boolean FloorCorrection, boolean TraceActors) throws CommunicationException
AutoTraceRay but its Future.
Use method Future.isDone() to check whether the ray was initialized and method Future.get() to obtain the ray instance.Direction - Vector direction of the ray (it will be relative - added to
the vector, where the bot is looking, also takes into
account angle of the floor the bot is standing on).Length - Specifies the length of the ray (in UT units).FastTrace - True if we want to use FastTrace function instead of Trace
function (a bit faster but less information provided - just
information if we hit something or not).FloorCorrection - If we should correct ray directions according floor normal. Note: Has issue - we can't set set rays up or down when correction is active.TraceActors - If we want to trace also actors, bots, monsters, players,
items. False if we want to trace just level geometry.Future.isDone() to check whether the ray was initialized and method Future.get() to obtain the ray instancecz.cuni.amis.pogamut.base.communication.exceptions.CommunicationExceptionCommunicationExceptionpublic AutoTraceRay getRay(String rayID)
Note that the AutoTraceRay instance is self updating - once obtained you may use it every
logic cycle to obtain current readings from the ray.
rayID - protected void checkIfAllInited()
allRaysInitialized flag to true if all rays has been initialized.Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.