[SOLVED]OnLaserHit/OnHitByLaser
6 posts • Page 1 of 1
[SOLVED]OnLaserHit/OnHitByLaser
Hi,
I've been trying to use OnLaserHit/OnHitByLaser, but neither seem to work. I used this code...
...in OnHitByLaser to change the target's colour, and it didn't do anything. I copied the script into the OnCollide text field and dropped an object on the target, and the colour changed fine! Does anyone know what's wrong? Is it a bug, or am I just missing something very obvious?
Thanks
I've been trying to use OnLaserHit/OnHitByLaser, but neither seem to work. I used this code...
(e)=>{e.this.color = [0, 0, 0, 1]}
...in OnHitByLaser to change the target's colour, and it didn't do anything. I copied the script into the OnCollide text field and dropped an object on the target, and the colour changed fine! Does anyone know what's wrong? Is it a bug, or am I just missing something very obvious?
Thanks
Last edited by tatt61880 on Thu Nov 11, 2010 10:23 am, edited 1 time in total.
Reason: Solved!
Reason: Solved!
- Torn
- Posts: 32
- Joined: Tue Sep 01, 2009 8:06 am
Re: OnLaserHit/OnHitByLaser
I think it's supposed to be e.geom.color or e.laser.color instead of e.this.color, I haven't messed with laser scripting for a long time, so it might have changed since then
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: OnLaserHit/OnHitByLaser
Thanks! e.geom.color worked perfectly, and e.laser.color changed the colour of the laser - handy to know. Again, thank you!
Now I've got another question... does anyone know how to measure a laser? I can't time it since it's instantaneous, and the only other way I can think of is scripting the laser to shorten bit by bit until you don't get an OnLaserHit... but that is a bit beyond me. Does anyone know another way?
Now I've got another question... does anyone know how to measure a laser? I can't time it since it's instantaneous, and the only other way I can think of is scripting the laser to shorten bit by bit until you don't get an OnLaserHit... but that is a bit beyond me. Does anyone know another way?
- Torn
- Posts: 32
- Joined: Tue Sep 01, 2009 8:06 am
Re: OnLaserHit/OnHitByLaser
Torn wrote:Thanks! e.geom.color worked perfectly, and e.laser.color changed the colour of the laser - handy to know. Again, thank you!
Now I've got another question... does anyone know how to measure a laser? I can't time it since it's instantaneous, and the only other way I can think of is scripting the laser to shorten bit by bit until you don't get an OnLaserHit... but that is a bit beyond me. Does anyone know another way?
I'm making a scene to do that, you need either a Kprobe style unit or another laser (im using another laser, i cant make probes proper to save my life) so i have one laser in my unit, which is taking the e.pos(0) and e.pos(1) of where it hits (which is a circle inside the unit infront of the laser) and a laser on the units outside fires at an object, then using some math you can work out the distance between the two objects.
hope that makes sense lol, i still dont know how to use the .math feature, so i'm not sure how im going to get the direct range yet, but i can get a co-ordinate output.
-
Torpedo - Posts: 120
- Joined: Mon Aug 31, 2009 8:51 pm
Re: OnLaserHit/OnHitByLaser
Torpedo wrote:Torn wrote:Thanks! e.geom.color worked perfectly, and e.laser.color changed the colour of the laser - handy to know. Again, thank you!
Now I've got another question... does anyone know how to measure a laser? I can't time it since it's instantaneous, and the only other way I can think of is scripting the laser to shorten bit by bit until you don't get an OnLaserHit... but that is a bit beyond me. Does anyone know another way?
I'm making a scene to do that, you need either a Kprobe style unit or another laser (im using another laser, i cant make probes proper to save my life) so i have one laser in my unit, which is taking the e.pos(0) and e.pos(1) of where it hits (which is a circle inside the unit infront of the laser) and a laser on the units outside fires at an object, then using some math you can work out the distance between the two objects.
hope that makes sense lol, i still dont know how to use the .math feature, so i'm not sure how im going to get the direct range yet, but i can get a co-ordinate output.
0.o Yikes... I wouldn't have the faintest idea how to do any of that, I think I'll just stick to my limited little ways...
- Torn
- Posts: 32
- Joined: Tue Sep 01, 2009 8:06 am
-
Paradigm 29 - Posts: 284
- Joined: Tue Sep 01, 2009 12:06 am
- Location: Houston, Tx
6 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 9 guests