I want to spread some particle effects over the surface of the wall or plane that was hit by a projectile. How can I get the necessary information about the angles (ideally the slope too) and use it like that?

(Ideally I'd like to be able to do it from a puff of a hitscan attack as well, but let's start with projectiles.)

The Line class has 2 member classes, v1 and v2, that have a member vector2 called p that holds the coordinates of the vertex, e.g. you can grab a position with "vector2 linestart=myline.v1.p;"

Then something something arctangents and trying to figure out which side of the linedef you're coming in from, in order to get the correct relative angle.

If you can get a pointer for the line, whether by checking the actor's blockingline or with some other check like LineTrace (which I believe would also get you the side of the line hit), the rest is just trying to figure out the fastest way to do it without null pointer VM crashes.

Sector struct have native "Sec(tor)Plane" struct, which contain "native Vector3 Normal;" variable, which is normal to the plane of a sector. You can find angle/slope/pitch of that sector from it, using some math.How to do so herehttps://en.wikipedia.org/wiki/Normal_(geometry)

ZS also has a native length() function: double length=(v2.p-v1.p).length();

(Might also want to check of the two positions are identical before calculating the length, just to save the extra square root call, but I haven't checked for sure since ASMJIT was added whether that would still be faster)

it is illegal to have zero-length lines on map. not that it is impossible, but any sane editor should warn and collapse that. the code was copypasted from my doom engine, therefore it has checks there. i mostly pasted it to save OP some effort on figuring out atan2 arguments. ;-)

p.s.: and i am pretty sure that you cannot hit zero-length lines anyway, so zero check can be safely omited.

Matt wrote:The Line class has 2 member classes, v1 and v2, that have a member vector2 called p that holds the coordinates of the vertex, e.g. you can grab a position with "vector2 linestart=myline.v1.p;"

I'll be honest, I'm too new to this to fully understand that First of all, do I understand correctly that v1 and v2 represent the two vertices of the line? Second, in vector2 linestart=myline.v1.p I honestly really understand only "vector2". Linestrat and myline are implied to be my variables? Sorry for the basic questions.