Full-3d trigger (contribution)

Suggest features for upcoming versions

Full-3d trigger (contribution)

Postby Crimson Wizard » 12 Jul 2006 05:13

I made it! :)
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?! :) 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?
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Firebrand » 12 Jul 2006 17:45

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 :).
User avatar
Firebrand
 
Posts: 1000
Joined: 11 Feb 2004 08:12
Location: Mexico

Postby Janis Legzdinsh » 12 Jul 2006 18:32

Both, Origin and MobjCenter are just points, you should check the whole line from Origin to Origin + vector(0.0, 0.0, Height).
User avatar
Janis Legzdinsh
Site Admin
 
Posts: 1952
Joined: 13 Jan 2002 08:30
Location: Limassol, Cyprus

Postby Crimson Wizard » 12 Jul 2006 19:40

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?
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Firebrand » 12 Jul 2006 20:38

AFAIK, there's no such function, but it could be done be combining some of the existing ones.
User avatar
Firebrand
 
Posts: 1000
Joined: 11 Feb 2004 08:12
Location: Mexico

Postby Crimson Wizard » 13 Jul 2006 17:02

Can you give me a hint then?
...or perhaps I should seek for my old Geometry conspects from 1st university year. :)


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).
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Firebrand » 14 Jul 2006 13:31

What would this polygon be? An Actor or a sector? I'm asking this to know which functions you would be combining :).

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 :).

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 :?.

Hope this helps you out :).
User avatar
Firebrand
 
Posts: 1000
Joined: 11 Feb 2004 08:12
Location: Mexico

Postby Crimson Wizard » 14 Jul 2006 15:43

Hmm... Firebrand, I see that you totaly misunderstood me. :? Well, perhaps I wasn't that clear.
I want to check whether Actor is crossing a polygon. Polygon - is a ...er... polygon :) - 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.
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Crimson Wizard » 18 Jul 2006 09:41

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?
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Firebrand » 18 Jul 2006 12:24

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 :).
User avatar
Firebrand
 
Posts: 1000
Joined: 11 Feb 2004 08:12
Location: Mexico

Postby Crimson Wizard » 18 Jul 2006 14:55

Actually I thought that Origin is a point at actor's feet and MobjCenter is an actor's XYZ center.
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Janis Legzdinsh » 18 Jul 2006 17:46

Yes, they have different z values.
User avatar
Janis Legzdinsh
Site Admin
 
Posts: 1952
Joined: 13 Jan 2002 08:30
Location: Limassol, Cyprus

Postby Crimson Wizard » 21 Jul 2006 19:21

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
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Postby Janis Legzdinsh » 22 Jul 2006 16:11

Only monsters have default action.
User avatar
Janis Legzdinsh
Site Admin
 
Posts: 1952
Joined: 13 Jan 2002 08:30
Location: Limassol, Cyprus

Postby Crimson Wizard » 23 Jul 2006 15:42

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.
Crimson Wizard
 
Posts: 881
Joined: 09 Nov 2005 14:21
Location: St. Petersburg, Russia

Next

Return to Feature suggestions

Who is online

Users browsing this forum: No registered users and 2 guests

cron