Back to the Vavoom Forum Archives


Forum

Full-3d trigger (contribution)

Wed, 12 Jul 2006 05:13:41

Crimson Wizard

I made it! <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> It is actually a 3d trigger, that allows to run action special as linedef does when player enters/exits predefined box (in other words - traverses one of its planes). This box can be positioned absolutely anywhere. Hey, may I contribute this to Vavoom?! <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> I need only to put there some additional code, since currently it does not use several flags such as 'repeatable'. About using. Trigger is implemented as 2 classes - Detector - is a base class for detector thing(s) (who knows, maybe there'll be more?) and TriggerBox - is a real trigger thing. It is placed on map in any location and assigned a TID and action special needed. Then 2 mapspots are placed where a 3d box should be and are assigned same TID as TriggerBox thing. When map starts, TriggerBox uses these mapspots to build a box by treating them as its opposite corners (that lie on box'es diagonal). Afterwards t removes mapspots from the map since they are not needed anymore. I am going to try making TriggerPlane as well. Well, there's still a question - should I use Origin or Mobjcenter to check mobj traverse box planes?
Wed, 12 Jul 2006 17:45:30

Firebrand

I would use the things Origin, since it marks it's actual position, MobjCenter marks the "center" of the things box, which actually makes not much change to me <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Wed, 12 Jul 2006 18:32:52

Janis Legzdinsh

Both, Origin and MobjCenter are just points, you should check the whole line from Origin to Origin + vector(0.0, 0.0, Height).
Wed, 12 Jul 2006 19:40:47

Crimson Wizard

Ok. What I wish to ask also. Is there a function in Vavoom that checks whether a line crosses a plane? - or can I use combination of some functions for this?
Wed, 12 Jul 2006 20:38:32

Firebrand

AFAIK, there's no such function, but it could be done be combining some of the existing ones.
Thu, 13 Jul 2006 17:02:23

Crimson Wizard

Can you give me a hint then? ...or perhaps I should seek for my old Geometry conspects from 1st university year. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> EDIT: 14 jul 2006: Seems I need not simply check if line's crossing a plane, but a line crossing a 4 sided polygon (in the best case it should work with 4 sided polygon of any shape and rotation).
Fri, 14 Jul 2006 13:31:44

Firebrand

What would this polygon be? An Actor or a sector? I'm asking this to know which functions you would be combining <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->. If the four sided polygon is an Actor you could "create" a virtual cube around the Actor, using points from it's FloorZ, to it's total Height, and it's total Radius to form the cube. Then you just determine which side of a double sided line the cube is and if the cube it's over a 3d floor or under it <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->. If the polygon is a sector, then it will need to use a different approach, you first would need to determine which side of the line it's touching, I don't know if using this could determine if you are under/over a 3d floor <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? -->. Hope this helps you out <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Fri, 14 Jul 2006 15:43:42

Crimson Wizard

Hmm... Firebrand, I see that you totaly misunderstood me. <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? --> Well, perhaps I wasn't that clear. I want to check whether Actor is crossing a polygon. Polygon - is a ...er... polygon <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> - a plane figure of some shape. In my case it is: a) 4-sided b) does NOT belong to level at all; it is described by some some variables of Trigger thing. How can I check whether Actor crosses it? I need to have Actor's previous position and current position (after movement). Then, I'll have two points. Thus I can build a line (segment - is right math term) based on these points. If this segment crosses a polygon - then it means that Actor passed thru it. Then, ofcourse, if I am going to represent Actor as a line, as Janis suggested, I'll need not line, but a plane, based on two lines, 1st is between previous and current Origin points, and another one is from prev. to current (Origin + Height) points, plus some extra calculations, but that is another story, so do not mind. Well, if it will be too difficult to make it this way, I will limit myself with only 2 possible cases - a vertical and horizontal rectangulars. But in ideal case it should be of any rotation and any shape (still 4-sided). EDIT: 15 jul 2006 Possibly I have found what I need. If this will fit my needs, I'll post it here so those who now Geometry better check whether it is right.
Tue, 18 Jul 2006 09:41:48

Crimson Wizard

I think I'm nearly on the "finish line", but I need an advice. I am making a detector subclass called TriggerPolygon. It represents a plane polygonal trigger in 3d space. What do you think, how much edges it should allow? 4 edges are obligatory in my opinion, since it is useful to block common passages by rectangular trigger, but what is more convenient in case of some more complex case: to have 5,6,8 - etc - edged polygonal trigger or use a combination of 3-4 edged triggers instead? Also, is there any difference between MapSpot's Origin & MobjCenter?
Tue, 18 Jul 2006 12:24:46

Firebrand

I think 4 sides it's the best option, I don't see a reason to have more sides, it would just make it more difficult to determine which points are touching and it's not more exact in any way IMO. Both MobjCenter and Origin are points, as Janis said some posts above, and they both point to the Z axis of the Actor (Mobj) position, so there's actually no difference between them <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Tue, 18 Jul 2006 14:55:13

Crimson Wizard

Actually I thought that Origin is a point at actor's feet and MobjCenter is an actor's XYZ center.
Tue, 18 Jul 2006 17:46:49

Janis Legzdinsh

Yes, they have different z values.
Fri, 21 Jul 2006 19:21:41

Crimson Wizard

Is there any default process that happens when Activate/Deactivate are called, or each class should have its own impementation of these functions? PS. I hope I'll finish first version of detectors this weekend. There will be: - TriggerPlane - TriggerPolygon - TriggerBox - TriggerSphere
Sat, 22 Jul 2006 16:11:30

Janis Legzdinsh

Only monsters have default action.
Sun, 23 Jul 2006 15:42:56

Crimson Wizard

May I be 100% sure that FindMobjFromTID function returns mobjes in order of their thing number (as they are placed on map in editor)? And also, can you add function for calculating angle between vectors (in 3d) ? It can be calculated using arctangent, which is present,, but then there's a need of square root function which is absent in VavoomC.
Sun, 23 Jul 2006 18:25:30

Janis Legzdinsh

May I be 100% sure that FindMobjFromTID function returns mobjes in order of their thing number (as they are placed on map in editor)?
I think currently it is, but you should not rely on that.
And also, can you add function for calculating angle between vectors (in 3d) ? It can be calculated using arctangent, which is present,, but then there's a need of square root function which is absent in VavoomC.
I think that if you first normalise the vectors, it shouldn't be needed. But I'll add them as these functions can be usefull.
Sun, 23 Jul 2006 19:04:32

Crimson Wizard

Well, If not mention small incompleteness, 3d triggers are done and working. I still need to make planar triggers check "active" side if it is set by map designer, and only way to do this I thought of is to find an angle between plane's normal and traversion path vector. Maybe it can be done somehow else?
Sun, 23 Jul 2006 20:57:52

Firebrand

I've got two questions, is the active side the line's side or an angle?
Mon, 24 Jul 2006 06:02:17

Crimson Wizard

Well, it's PLANE's side, not line's. But an idea comes from original linedefs trigger, where is "active" side defined, so map designer may say in scripts that action should be performed only if active (front) side was surpassed. I wish my planar triggers has the same ability.
Mon, 24 Jul 2006 11:48:31

Crimson Wizard

Hmm, I was wrong, I suppose I can simply use DotProduct for this purpose. I'll take DotProduct between predefined normal & traverse path vectors. If result is > 0, than plane is traversed from its "back" side, if result is < 0 than plane is traversed from "front" size.
Mon, 24 Jul 2006 17:50:15

Janis Legzdinsh

Yes, that's the right way to do this.
Tue, 25 Jul 2006 20:11:40

Crimson Wizard

Well, ahem, Janis, what would you say if I send you my detectors' sources. Maybe they will be useful in Vavoom. These sources include math functions as well, I suppose that if you take this contribution it is better to put all that math into Object class. There's also small addition to Actor::Tick() function and a small function in HexenLevelInfo, which manages detectors. I can also send a tiny map on which I tested these detectors and instructions how to create them.
Wed, 26 Jul 2006 23:06:58

Janis Legzdinsh

Sure, I'll check them out.
Thu, 27 Jul 2006 05:34:57

Crimson Wizard

eMailed them.
Wed, 02 Aug 2006 19:18:41

Mago KH

Sorry guys, not to sound like a total retard (which I'm not far from anyway), but I think you Crimson Wizard simply forgot to mention to complete square heads like me what exactly those triggers you worked so hard on are used for????.... <!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarassed" /><!-- s:oops: --> What is their true purpouse, that couldn't be achieved before by the ordinary map maker out there? I'm sincerely curious, not trying to criticize in any way, it's great to see the whole thing growing, but Im lost... (not the first time). <!-- s:cry: --><img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very sad" /><!-- s:cry: --> My interest in map making originates directly from the capacities introduced by Vavoom (as far as 3d floors enable you to do architecture wise), so any detailed info on some of it' features (and now your user-made changes) are a great plus for guys like me who simply doesn't have the physical time to sit down and test something for hours...
Wed, 02 Aug 2006 19:32:33

Crimson Wizard

Oh, hello Mago, haven't met you since our talk about Slopes tutorial. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> [quote="Mago KH":18prrm5w]What is their true purpouse, that couldn't be achieved before by the ordinary map maker out there? Actually I thought I explained that already somewhere <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? --> Ah, here it is: <!-- m --><a class="postlink" href="http://www.korax-heritage.com/forums/viewtopic.php?t=1613&start=15">http://www.korax-heritage.com/forums/vi ... 3&start=15</a><!-- m --> (KH Team password needed)
The problem is that with all those 3dfloors you still cannot make 3d trigger. For example, you make complex maps with several levels one above another, then you will wonder how to make a trigger (which runs some action special) detect player only if he is standing on exact level. It is almost impossible to make this using common linedefs. So, I invented this solution: created new object class that manages triggering. It uses not lines, but Map Spots to specify triggering area, thus making it possible to detect player crossing exact space literally in any point of map at any height.
By the way, Janis, what is your thought about overall implementation? Any problems, mistakes, bugs etc?
Thu, 03 Aug 2006 17:53:56

Janis Legzdinsh

Actually you can check the z coordinate of actor in ACS using GetActorZ(0) function and triger action if it's in needed range. I haven't checked you files yet.
Thu, 03 Aug 2006 18:14:31

Crimson Wizard

Oh no, why I haven't knew that earlier... <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> *sigh* Well, still my triggers allow checking actor crossing horizontal plane, and plane having any rotation around 3 axes. And also checking not only Actor's z position as point, but Actor's full height (from "feet" to "head"). And easing design process anyway... eh, just hope they may be useful. EDIT: Excuse me, but where is this GetActorZ ACS command is declared? I searched through acs'es but found only one occurence in strfhelp.acs:
//	Raise alert if touched laser.
if (GetActorFloorZ(0) + 16.0 > GetActorZ(0))
{
	NoiseAlert(0, 0);
}
Thu, 03 Aug 2006 20:16:43

Firebrand

I think ACS commands logic is declared in the core of the eninge (i.e. the executable source).
Thu, 03 Aug 2006 22:03:47

Janis Legzdinsh

It's hardcoded in acc.exe.
Fri, 04 Aug 2006 07:12:24

Crimson Wizard

And where I can get specification which describes this function? Perhaps there are even more of ACS commands that I do not know.
Fri, 04 Aug 2006 15:00:11

Mago KH

[quote="Crimson Wizard":2w0e8tw2]Oh, hello Mago, haven't met you since our talk about Slopes tutorial. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> [quote="Mago KH":2w0e8tw2]What is their true purpouse, that couldn't be achieved before by the ordinary map maker out there? Actually I thought I explained that already somewhere <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? --> Ah, here it is: <!-- m --><a class="postlink" href="http://www.korax-heritage.com/forums/viewtopic.php?t=1613&start=15">http://www.korax-heritage.com/forums/vi ... 3&start=15</a><!-- m --> (KH Team password needed)
The problem is that with all those 3dfloors you still cannot make 3d trigger. For example, you make complex maps with several levels one above another, then you will wonder how to make a trigger (which runs some action special) detect player only if he is standing on exact level. It is almost impossible to make this using common linedefs. So, I invented this solution: created new object class that manages triggering. It uses not lines, but Map Spots to specify triggering area, thus making it possible to detect player crossing exact space literally in any point of map at any height.
By the way, Janis, what is your thought about overall implementation? Any problems, mistakes, bugs etc? Hehe, sorry, we have never been properly introduced, but it's a pleasue seeing you working on the Korax project, I'm very happy you are around! (Even though I hardly post, I'm always trying to keep updated with the latest works on there). Anyway, thanks for trying to enlighten me, but unfortunetly I still didnt get it... I guess this is all for making it possible to assign functions (triggers) to 3d sectors as true 3d objects, thus not relying solely on the limitations of linedefs, but surely I got a lot of things wrong... But dont mind me, I wont take more of your time and keep you from doing your work! <!-- s;) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";)" title="Wink" /><!-- s;) --> When I actually restart work on maps (right now sprites is all I eat), be sure I'll come back and ask some more! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Fri, 04 Aug 2006 15:56:52

Crimson Wizard

It seems to me that you understood general idea right. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
Fri, 04 Aug 2006 17:26:08

Janis Legzdinsh

[quote="Crimson Wizard":e930t09u]And where I can get specification which describes this function? Perhaps there are even more of ACS commands that I do not know. ZDoom's wiki describes them all. Note that not all of the new ones are supported by Vavoom.
Mon, 29 Oct 2007 14:10:22

Crimson Wizard

New type of spambot? <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->

Back to the Vavoom Forum Archives