Find origin of trigger_objective_info entities


(Magik) #1

I want to find the origin of all “trigger_objective_info” entities to do some calculations for my mod but some of them don’t seem to use “s.origin” or “r.currentOrigin” as both fields are zero.

I tried some other fields like “pos.trBase” but they are zero two. Odd enough some trigger entities have the origin information but some don’t. I think the engine has to track them somehow, so the information has to be somewhere or am I wrong?

Any suggestions would be great.

Thanks in advance.


(MadJack) #2

The way we make maps with TOI is that we func_group it with an origin textured brush. Now, I have absolutely no clue how that could be helpful to you but that’s the way we set those up :slight_smile:

HTH somehow :smiley:


(No1_sonuk) #3

IIRC, the origin is at the “centre of mass” unless you give it an origin brush as MadJack described.

So a cube’s orgin would be at the intersction of lines drawn between the centres of opposing squares.

Sorry, I’m at work, so I can’t give you a picture.


(Magik) #4

Hmm, think I got your idea. Maybe I can use absMin/absMax to calculate the origin, seems they are set correctly.


([RW]FRED) #5

trigger_objective_info is an abstract entity used to regroup some children entitiies such as spawnpoint or what u want. it not necessary that this ent must be placed near the real objective. To do what u want ,u can use spawnpoints ents linked with the objective info. But if u give us more infos what u want to do, we will able to give u the best solution.

regards


(Magik) #6

absMin/Max works perfectly well. :slight_smile:
What I want to do is some calculation on where construction points are and stuff like that. Thats why I needed the origin of the TOI and not the linked entity’s origin, which may (as you said) be somewhere else on the map and not even near.

If somebody encounters the same problem here is my solution:


VectorAdd(ent->r.absmax, ent->r.absmin, pos);
VectorScale(pos, 0.5, pos);

and there you have the position of the TOI. :slight_smile:


([RW]FRED) #7

it’s strange, because ent->r.absmin/absmax is set when u call trap_LinkEntity(…) with the entity by the use of ent->r.currentOrigin & ent->r.mins, ent->r.maxs. It’s mean that somewhere in ur code u clear ent->r.currentOrigin


(MadJack) #8

I might add that most ent have an origin key/value, TOI don’t have one when we insert it in a map. Don’t know if that’s relevant to the above but I thought I’d mention it.