AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How do I find the normal vector of the brush face used to make a displacement? (https://forums.alliedmods.net/showthread.php?t=332619)

Sappykun 05-23-2021 02:50

How do I find the normal vector of the brush face used to make a displacement?
 
I want to find the orientation of a displacement based on the angle of the brush face that was used to create it. Without decompiling a map, is there a way to find that?

What I'm trying to accomplish is determine how a player's spray will appear on a given surface.
I've observed that a spray:
- points North on a brush with a vertical angle below 45 degrees and above 135 degrees (both inclusive)
- points upwards on a brush with a vertical angle between 45 and 135 degrees (both exclusive)
I can easily determine the angle of a given surface by using TR_GetPlaneNormal, so that's not an issue.

What I've found is that sprays on displacements seem to use the same rules as brushes, except their orientation is dependent on the original surface used to create it, regardless of what angle the displacement is currently at.

I'll replace these sketches with an example in Hammer soon, but for now:



In this example, I make a half-pipe out of a flat brush, making the west and east sides vertical. The sprays on the displacement point north, even if they're sprayed on the vertical parts of the pipe. This makes them point sideways when viewed from the center of the pipe.



In this example, I make the north and south sides vertical. The sprays keep pointing north, but now the left spray will be upside down and the right spray will be pointing up when viewed from the center.

I've tried using TR_GetDisplacementFlags which can determine if I'm looking at a displacement or not, but it doesn't give me information about its orientation.


All times are GMT -4. The time now is 00:16.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.