Author | Message |
amilmand
Posts: 259
Location: --- Occupation: Age: V$: |
#138094 2018-02-28 21:27 |
gorgoil: This was quite some time ago but I found out that there is a box trigger "natively" in the game check the source of the Trigger class there is a constructor for it: public Trigger( GameRef parent, GameRef type, Vector3 pos, float x, float y, float z, String alias) { if( type == null ) type = new GameRef( DEFAULT ); trigger = new GameRef(parent, type.id(), pos.toString() +",0,0,0,box,"+ x +","+ y +","+ z, alias); } Added 30 minutes later: Oh and I'm fairly certain that the 3 zeros following the position are the ypr rotation coordinates. trigger = new GameRef(parent, type.id(), pos.toString() +",y,p,r,box,"+ x +","+ y +","+ z, alias);So someone can make box triggers with 9 degrees of freedom if needs be. Added 1 hour 23 minutes later: Here is a function for ease of use (this can be used with the addTrigger function of the track class with the signature: public Trigger addTrigger( Trigger t, Vector3 pos, RenderRef marker, String handler )) public Trigger MakeBoxTrigger( GameRef parent, GameRef type, Vector3 pos, float x, float y, float z, float yaw, float pitch,float roll, String alias) { Trigger ret = new Trigger(parent,type,pos,alias); ret.trigger.destroy(); ret.trigger=null; if( type == null ) type = new GameRef( system:0x00000034r ); ret.trigger = new GameRef(parent, type.id(), pos.toString() +","+yaw+","+pitch+","+roll+",box,"+ x +","+ y +","+ z, alias); return ret; } This post was edited by amilmand (2018-02-28 23:21, ago) |
|