Need help with lasersight.

Is there a way of stopping the laser from going through the plane?
http://www.freeuploader.com/out.php/i16403_laserprob.JPG
http://www.freeuploader.com/out.php/i16404_laserprob2.JPG

See, I’m trying to have it where once it comes into contact with an object, its size decreases as the laser moves closer to the object. A good example is in the game Resident Evil 4(don’t know if anyone’s played it). The character’s weapons have lasersights that appear to decrease in size when he moves closer to the object its in contact with.

The size, I believe, could be solved with a simple size IPO on the Y-axis, but figuring out how to set it up is the problem. The empty is supposed to be used to add an effect like water splash, dust, smoke, etc. depending on what surface its in contact with.

this seems to be possiople with python NMESH , but this appears to be hard … :frowning:

http://img159.imageshack.us/img159/9144/laser5wd.th.png
maybe this helps an example .blend

http://www.savefile.com/files/9980792

:smiley:

You would need python to determine the distance between the two object. That can easily be done with a raysensor.
GetPosition() gives you the position of the object casting the ray.
GetHitPosition() gives you the position where the ray hits the target.
Now you could determine the distance with the formula sqrt( xx, yy, z*z). See the example in the previous post.

You can use the distance to set the IPO scale. I’m not sure if you could work with float here.

Another way would be to set the orientation matrix ( setOrientation() ) to perform the scaling. The orientation matrix would be following:

[[scale, 0, 0],
[0, scale, 0],
[0, 0, scale]]
Where scale is the distance from above. Be aware this removes any rotation!

do you want the actual laser beam to get bigger (which just looks silly) or the spot on the wall?:confused: