View Javadoc

1   
2               /**
3               IMPORTANT !!!
4   
5               DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbcommands BY
6               THE JavaClassesGenerator.xslt. MODIFY THESE FILES INSTEAD OF THIS ONE.
7   
8               IMPORTANT END !!!
9               */
10              package
11              cz.cuni.amis.pogamut.udk.communication.messages.gbcommands;
12  	    		import java.util.*;
13      import javax.vecmath.*;
14      import cz.cuni.amis.pogamut.base.communication.messages.*;
15      import cz.cuni.amis.pogamut.base.communication.worldview.*;
16      import cz.cuni.amis.pogamut.base.communication.worldview.event.*;
17      import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
18      import cz.cuni.amis.pogamut.base.communication.translator.event.*;
19      import cz.cuni.amis.pogamut.base3d.worldview.object.*;
20      import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;
21      import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
22      import cz.cuni.amis.pogamut.udk.communication.messages.*;
23      import cz.cuni.amis.pogamut.udk.communication.worldview.objects.*;
24      import cz.cuni.amis.pogamut.udk.communication.translator.itemdescriptor.*;
25      import cz.cuni.amis.pogamut.udk.communication.messages.ItemType.Category;
26      import cz.cuni.amis.utils.exception.*;
27      import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;
28      import cz.cuni.amis.utils.SafeEquals;
29      import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;
30      
31              
32              /**
33                
34  		Add custom ray for automatic ray tracing. If you send Id =
35  		Default, all rays will be erased and default set of rays will be
36  		loaded (straight ahead (1,0,0) with 250 length, 45 degrees left
37  		(1,–1,0) with 200 length, 45 degrees right (1,1,0) with 200
38  		length). This set of rays is also loaded by default. If you want
39  		to change existing ray, just support its Id in ADDRAY command
40  		along with new parameters. Direction of the rays work as
41  		follows. Bot is looking to x axis, that means if I want ray
42  		straight ahead I specify some vector on positive x axis (vectors
43  		in unreal are specified by (x,y,z) so it would look like this
44  		(1,0,0) or this (123,0,0) – numbers doesn't matter, its about
45  		direction - vectors will be normalized). If I want ray behind it
46  		would be (–1,0,0). 90 degrees right (0,1,0) etc.
47  	
48                            Corresponding GameBots command is
49                            ADDRAY.
50                        
51               */
52              
53              public class
54              AddRay extends
55          CommandMessage
56  
57              {
58              
59              /**
60                Creates new instance of command AddRay.
61                
62  		Add custom ray for automatic ray tracing. If you send Id =
63  		Default, all rays will be erased and default set of rays will be
64  		loaded (straight ahead (1,0,0) with 250 length, 45 degrees left
65  		(1,–1,0) with 200 length, 45 degrees right (1,1,0) with 200
66  		length). This set of rays is also loaded by default. If you want
67  		to change existing ray, just support its Id in ADDRAY command
68  		along with new parameters. Direction of the rays work as
69  		follows. Bot is looking to x axis, that means if I want ray
70  		straight ahead I specify some vector on positive x axis (vectors
71  		in unreal are specified by (x,y,z) so it would look like this
72  		(1,0,0) or this (123,0,0) – numbers doesn't matter, its about
73  		direction - vectors will be normalized). If I want ray behind it
74  		would be (–1,0,0). 90 degrees right (0,1,0) etc.
75  	Corresponding GameBots message for this command is
76                ADDRAY.
77                    @param Id 
78  			User set Id of the ray, so the ray can be identified.
79  		
80                    @param Direction 
81  			Vector direction of the ray (it will be relative - added to
82  			the vector, where the bot is looking, also takes into
83  			account angle of the floor the bot is standing on).
84  		
85                    @param Length 
86  			Specifies the length of the ray (in UT units).
87  		
88                    @param FastTrace 
89  			True if we want to use FastTrace function instead of Trace
90  			function (a bit faster but less information provided - just
91  			information if we hit something or not).
92  		
93                    @param FloorCorrection 
94        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.
95  		
96                    @param TraceActors 
97  			If we want to trace also actors – bots, monsters, players,
98  			items. False if we want to trace just level geometry.
99  		
100               */
101              public AddRay(
102                 String Id,  Vector3d Direction,  int Length,  boolean FastTrace,  boolean FloorCorrection,  boolean TraceActors) {
103                     
104                     this.Id = Id;
105                 
106                     this.Direction = Direction;
107                 
108                     this.Length = Length;
109                 
110                     this.FastTrace = FastTrace;
111                 
112                     this.FloorCorrection = FloorCorrection;
113                 
114                     this.TraceActors = TraceActors;
115                 
116                 }
117 
118             
119             		/**
120 		             Creates new instance of command AddRay.
121 		             
122 		Add custom ray for automatic ray tracing. If you send Id =
123 		Default, all rays will be erased and default set of rays will be
124 		loaded (straight ahead (1,0,0) with 250 length, 45 degrees left
125 		(1,–1,0) with 200 length, 45 degrees right (1,1,0) with 200
126 		length). This set of rays is also loaded by default. If you want
127 		to change existing ray, just support its Id in ADDRAY command
128 		along with new parameters. Direction of the rays work as
129 		follows. Bot is looking to x axis, that means if I want ray
130 		straight ahead I specify some vector on positive x axis (vectors
131 		in unreal are specified by (x,y,z) so it would look like this
132 		(1,0,0) or this (123,0,0) – numbers doesn't matter, its about
133 		direction - vectors will be normalized). If I want ray behind it
134 		would be (–1,0,0). 90 degrees right (0,1,0) etc.
135 	Corresponding GameBots message for this command is
136 		             ADDRAY.
137 		             <p></p>WARNING: this is empty-command constructor, you have to use setters to fill it up!
138 		             */
139             		public  AddRay() {
140             		}
141             	
142 
143             /////// Properties BEGIN
144             
145         /**
146         
147 			User set Id of the ray, so the ray can be identified.
148 		 */
149         protected
150          String Id =
151         	null;
152 
153         
154         /**
155         
156 			User set Id of the ray, so the ray can be identified.
157 		 */
158         public
159         String getId() {
160             return
161          Id;
162         }
163         
164 
165         
166             /**
167         
168 			User set Id of the ray, so the ray can be identified.
169 		 */
170         public AddRay setId(String Id) {
171             this.Id = Id;
172             return this;
173             }
174        
175         /**
176         
177 			Vector direction of the ray (it will be relative - added to
178 			the vector, where the bot is looking, also takes into
179 			account angle of the floor the bot is standing on).
180 		 */
181         protected
182          Vector3d Direction =
183         	null;
184 
185         
186         /**
187         
188 			Vector direction of the ray (it will be relative - added to
189 			the vector, where the bot is looking, also takes into
190 			account angle of the floor the bot is standing on).
191 		 */
192         public
193         Vector3d getDirection() {
194             return
195          Direction;
196         }
197         
198 
199         
200             /**
201         
202 			Vector direction of the ray (it will be relative - added to
203 			the vector, where the bot is looking, also takes into
204 			account angle of the floor the bot is standing on).
205 		 */
206         public AddRay setDirection(Vector3d Direction) {
207             this.Direction = Direction;
208             return this;
209             }
210        
211         /**
212         
213 			Specifies the length of the ray (in UT units).
214 		 */
215         protected
216          int Length =
217         	0;
218 
219         
220         /**
221         
222 			Specifies the length of the ray (in UT units).
223 		 */
224         public
225         int getLength() {
226             return
227          Length;
228         }
229         
230 
231         
232             /**
233         
234 			Specifies the length of the ray (in UT units).
235 		 */
236         public AddRay setLength(int Length) {
237             this.Length = Length;
238             return this;
239             }
240        
241         /**
242         
243 			True if we want to use FastTrace function instead of Trace
244 			function (a bit faster but less information provided - just
245 			information if we hit something or not).
246 		 */
247         protected
248          boolean FastTrace =
249         	false;
250 
251         
252         /**
253         
254 			True if we want to use FastTrace function instead of Trace
255 			function (a bit faster but less information provided - just
256 			information if we hit something or not).
257 		 */
258         public
259         boolean isFastTrace() {
260             return
261          FastTrace;
262         }
263         
264 
265         
266             /**
267         
268 			True if we want to use FastTrace function instead of Trace
269 			function (a bit faster but less information provided - just
270 			information if we hit something or not).
271 		 */
272         public AddRay setFastTrace(boolean FastTrace) {
273             this.FastTrace = FastTrace;
274             return this;
275             }
276        
277         /**
278         
279       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.
280 		 */
281         protected
282          boolean FloorCorrection =
283         	false;
284 
285         
286         /**
287         
288       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.
289 		 */
290         public
291         boolean isFloorCorrection() {
292             return
293          FloorCorrection;
294         }
295         
296 
297         
298             /**
299         
300       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.
301 		 */
302         public AddRay setFloorCorrection(boolean FloorCorrection) {
303             this.FloorCorrection = FloorCorrection;
304             return this;
305             }
306        
307         /**
308         
309 			If we want to trace also actors – bots, monsters, players,
310 			items. False if we want to trace just level geometry.
311 		 */
312         protected
313          boolean TraceActors =
314         	false;
315 
316         
317         /**
318         
319 			If we want to trace also actors – bots, monsters, players,
320 			items. False if we want to trace just level geometry.
321 		 */
322         public
323         boolean isTraceActors() {
324             return
325          TraceActors;
326         }
327         
328 
329         
330             /**
331         
332 			If we want to trace also actors – bots, monsters, players,
333 			items. False if we want to trace just level geometry.
334 		 */
335         public AddRay setTraceActors(boolean TraceActors) {
336             this.TraceActors = TraceActors;
337             return this;
338             }
339        
340             /////// Properties END
341 
342             /////// Extra Java code BEGIN
343 
344             	/////// Additional code from xslt BEGIN
345             		
346 
347 
348             	/////// Additional code from xslt END
349 
350 	            /////// Extra Java from XML BEGIN
351             		
352             	/////// Extra Java from XML END
353 
354             /////// Extra Java code END
355 
356             
357 
358             /**
359               * Cloning constructor.
360               */
361              public AddRay(AddRay original) {
362                 
363                      this.Id=original.Id;
364                 
365                      this.Direction=original.Direction;
366                 
367                      this.Length=original.Length;
368                 
369                      this.FastTrace=original.FastTrace;
370                 
371                      this.FloorCorrection=original.FloorCorrection;
372                 
373                      this.TraceActors=original.TraceActors;
374                 
375              }
376 
377              
378 
379                  
380             public String toString() {
381                 return
382                 
383                     	toMessage();
384                     
385              }
386 
387              public String toHtmlString() {
388                 return super.toString() +
389             
390             "<b>Id</b> : " +
391             String.valueOf(Id) +
392             " <br/> " +
393             
394             "<b>Direction</b> : " +
395             String.valueOf(Direction) +
396             " <br/> " +
397             
398             "<b>Length</b> : " +
399             String.valueOf(Length) +
400             " <br/> " +
401             
402             "<b>FastTrace</b> : " +
403             String.valueOf(FastTrace) +
404             " <br/> " +
405             
406             "<b>FloorCorrection</b> : " +
407             String.valueOf(FloorCorrection) +
408             " <br/> " +
409             
410             "<b>TraceActors</b> : " +
411             String.valueOf(TraceActors) +
412             " <br/> " +
413              "";
414              }
415 
416              
417              
418              	 public String toMessage() {
419               		StringBuffer buf = new StringBuffer();
420               		buf.append("ADDRAY");
421               		
422 		    					if (Id != null) {
423 		    						buf.append(" {Id " + Id + "}");
424 		    					}
425 		    				
426 		    					if (Direction != null) {
427 		    						buf.append(" {Direction " +
428 		    							Direction.getX() + "," +
429 		    							Direction.getY() + "," +
430 		    							Direction.getZ() + "}");
431 		    					}
432 		    				
433 		    					buf.append(" {Length " + Length + "}");
434 		    				
435 		    					buf.append(" {FastTrace " + FastTrace + "}");
436 		    				
437 		    					buf.append(" {FloorCorrection " + FloorCorrection + "}");
438 		    				
439 		    					buf.append(" {TraceActors " + TraceActors + "}");
440 		    				
441             		return buf.toString();
442             }
443              
444              }
445 
446