Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: rubixcube on January 24, 2014, 11:19:39 pm

Title: laser hitbox
Post by: rubixcube on January 24, 2014, 11:19:39 pm
how are laser hitboxes determined in FS? I always assumed it was laser head radius but sometimes gameplay doesn't seem to correlate with that
Title: Re: laser hitbox
Post by: Alan Bolte on January 29, 2014, 08:08:18 pm
Seeing as no one more knowledgeable replied - I'm fairly certain the lasers are just a point in space, and don't have an actual hit radius.
Title: Re: laser hitbox
Post by: zookeeper on January 30, 2014, 01:23:15 am
As far as ship<->weapon collisions are concerned, yes, I'm pretty sure lasers are treated as one-dimensional rays.
Title: Re: laser hitbox
Post by: rubixcube on January 30, 2014, 10:02:02 pm
Interesting, that's certainly not what I expected, and it's difficult to wrap my head around; the game engine can somehow detect collisions with something with no physical dimensions.
Title: Re: laser hitbox
Post by: niffiwan on January 30, 2014, 10:09:23 pm
It's kinda got physical dimensions, just really small ones. i.e. a single position in space represented by 32bit floats. The ray bit would just be relevant in collisions to check the difference in position between 2 frames.

(although I'll admit that I haven't really looked at this section of the code, this is mostly how I *think* it works!)
Title: Re: laser hitbox
Post by: zookeeper on January 31, 2014, 02:39:03 am
Interesting, that's certainly not what I expected, and it's difficult to wrap my head around; the game engine can somehow detect collisions with something with no physical dimensions.

Well, collision detection is all math, and it's actually a whole lot easier and especially a lot faster to check if and where a line intersects a bunch of triangles than it is to check if and where two different bunches of triangles intersect each other.

When the game checks for laser collisions, it basically looks where the laser was last frame and where it is now, draws an imaginary line between those two points and then checks whether and where that line intersects any other objects in the game.

That said, if someone had a need to make really wide lasers which should have a more wide "hitbox", then such a feature would be very much possible.
Title: Re: laser hitbox
Post by: X3N0-Life-Form on January 31, 2014, 01:53:28 pm
Thinking about the giant Akrotiri main gun thingy from Ancient-Shivan War, that would certainly be something to think about.
Title: Re: laser hitbox
Post by: AndrewofDoom on February 08, 2014, 11:55:33 am
ShmupSpace would benefit a lot from laser not having just collision at the very tail end of it. It really confused me at first as to why I wasn't getting hit until I realized that.
Title: Re: laser hitbox
Post by: Aardwolf on February 09, 2014, 03:59:24 pm
It's the head, not the tail.
Title: Re: laser hitbox
Post by: AndrewofDoom on February 17, 2014, 03:31:00 pm
It's the head, not the tail.

No, it's definitely the tail. Or, more accurately, the center of the laser. Just the tail is dead center on that point. models don't have to obey that since the origin can be wherever relative to the rest of the model.