Elevator Script

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 4th, 2013, 12:20 am

KillerSam wrote:...
Yes, but I will check tomorrow and confirm.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Elevator Script

Post by megazor » May 4th, 2013, 11:39 am

The origin of a brushmodel cannot be bound to world (map) coordanates. It simply doesn't deal with them. By default, the brushmodel origin is (0, 0, 0), but you can change it: either add an origin brush or enter a key "origin" and corresponding value "x y z" in the entity settings. Either way, you can set any numbers as the origin, not necessarily the current position of the model in Radiant.

MoveTo() will move to the given position (using model coordinates, not world ones).

MoveX(length, time) can be performed as MoveTo( (entity.origin[0]+length, entity.origin[1], entity.origin[2]), time)

So, basically, moveX() will move an entity along axis X by the given number, having the entity origin as an offset.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 4th, 2013, 11:58 pm

MoveTo deals with WORLD coordinates when the model has an origin brush.

Code: Select all

ent_1 = getent("ent1","targetname");
ent_2 = getent("ent2","targetname");
ent_1 moveto((ent_2 getOrigin(), 0.05);
ent_1 moves to the world coordinates assigned to ent_2.

Code: Select all

ent_1 moveto((0,0,0),0.05);
/setviewpos 0 0 0 0
Move the entity to the center of the world (based on radiant .map)
Then set yourself to the center of the map using setviewpos (which works off map coordinates)
You are inside the brush origin.

All tested.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Elevator Script

Post by megazor » May 5th, 2013, 3:39 am

The problem is, you can place the origin brush ANYWHERE in the map, not necessarily into the model. And the model will always have the origin of the origin brush, which, once again, can be a n y w h e r e.

Let's say a model is at (0, 0, 50) world coordinates, and its origin brush is at (0, 0, 10000).
If you then do moveTo((0, 0, 0), time), don't expect the model to move only 50 units - it will fall down by 10000, leaving the center of the map far away (although the invisible origin brush will get to the center).

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 5th, 2013, 11:30 am

That goes without saying surely, the world coordinates of a model are calculated on their origin.
Was that ever even in question?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Elevator Script

Post by megazor » May 5th, 2013, 11:40 am

I think you failed

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 5th, 2013, 11:56 am

megazor wrote:I think you failed
I think you clearly misunderstood the answer given and therefore wrongly interpreted a failure, where in fact the answer was correct before you had even arrived.

If you have nothing of value to add, do not pollute this forum.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Elevator Script

Post by Rezil » May 5th, 2013, 1:05 pm

megazor wrote:The origin of a brushmodel cannot be bound to world (map) coordanates. It simply doesn't deal with them.
Wrong.
megazor wrote:MoveTo() will move to the given position (using model coordinates, not world ones).
What? MoveX/Y/Z moves the entity relative to its original position, moveTo moves the entity to a specific position in the world. So you're wrong, it uses world coordinates to move the entity to a certain position(using the entity origin in both moveTo and moveX/Y/Z).
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Elevator Script

Post by megazor » May 5th, 2013, 1:59 pm

moveTo moves the entity to a specific position in the world
And that "world" is different from the Radiant one. You can, of course, match it with real coordinates by placing an origin brush somewhere close to the visible parts of the entity. Any way, the origin will be the middle point of the origin brush, regardless of the other brushes which make up the entity. Read my previous post again, you can place an origin brush anywhere - thus, having the visible parts of the entity fixed, by moving the origin brush in Radiant you will be getting different origins.

I don't know why you both don't understand this simple fact: brushmodels use their own coordinates, not the world ones, regardless of having an origin brush. These local coordinates can match the world ones, but they don't have to.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 5th, 2013, 4:33 pm

megazor wrote:I don't know why you both don't understand this simple fact: brushmodels use their own coordinates, not the world ones, regardless of having an origin brush. These local coordinates can match the world ones, but they don't have to.
CoD4 does NOT require an origin model, the brushmodels are directly linked to world coordinates.
CoD2 use local coordinates and requires an origin model to define it. If you do not define the origin with the origin brush, moveTo will move as an offset to the brushmodels center.

Tested. Try for yourself - if you get different results, post them here.

Code: Select all

        
// Brushmodel w/ origin
test1 = getEnt("test1","targetname");
// Brushmodel w/o origin
test2 = getEnt("test2","targetname");
 
trig = getEnt("trig", "targetname");
trig waittill("trigger");
test1 moveto((10,10,10), 3);
test2 moveto((10,10,10), 3);
CoD4:
Both brushmodels move to the WORLD coordinates.

CoD2:
test1 goes to WORLD coordinates
test2 moves 10 as if using moveX/Y/Z(10).

Also, as reference, I placed a brush at the RADIANT coordinates (10,10,10) - and as expected they are the world coordinates...
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Elevator Script

Post by megazor » May 6th, 2013, 6:10 am

I didn't know about cod4, i thought it would be the same as in cod1-2.

Now the key question about your cod2 test. Where is the origin brush situated in respect of the visible parts of "test1"? Check and you will make sure that the position of your origin brush does have an influence on the movement of "test1". Place the origin brush 100 units higher, and you will notice that it doesn't move to world coordinates any longer. It is because, when calculating an origin for "test1", the game doesn't give a shit about all brushes of it but the origin brush. This is what I have been talking about since I arrived. Only an origin brush of an entity will move to the world coordinates, the other brushes of the entity will do the same ONLY in case you kept them very close to the origin brush in Radiant.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 6th, 2013, 11:10 am

megazor wrote:...
1. This is the CoD4 mapping section, it should be the only game in discussion, however...

2. Never has anyone disputed the way an origin brush works, in fact I am fairly sure there are tutorials I made for someone about how to correctly use the origin as a pivoting point.
It is by definition the origin of the script_brushmodel (any entity moved in-game is simply the movement of a tag_origin, the rest of the structure copies the translation about the origin).

3. "ONLY in case you kept them very close to the origin brush in Radiant" is wrong.
I placed my origin at (5000,0,0) and my brush at (0,0,0)
brush moveTo(0,0,0,t);
My origin is now at (0,0,0) and my brush is now at (-5000,0,0)
Distance between the origin and brushes are irrelevant.

The problem with your misunderstanding lies in the definitions you are using.
In CoD2, when you do NOT define an origin brush, the game treats the centre of the brush as its origin and assigns it a value of (0,0,0) and all commands are respective of that origin.
When you DO use an origin brush, the game treats the origin brush as the centre and assigns it a value equal to the position in the world/radiant and all commands are respective of that.
There are NEVER two separate origins, you cannot move either the brushes or the origin brush exclusively - they are a single entity.

Everything I have said above holds true to testing and has been given a confirmed second opinion. If anything I have said is wrong, please quote/underline and provide proof of it being wrong - because we are going round in circles explaining the same shit over and over.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: Elevator Script

Post by megazor » May 6th, 2013, 12:34 pm

I placed my origin at (5000,0,0) and my brush at (0,0,0)
brush moveTo(0,0,0,t);
My origin is now at (0,0,0) and my brush is now at (-5000,0,0)
Yes. This is true. The brush is NOT at the world coordinates, although it has an origin particle. And you were saying in your previous posts that if a brusmodel had an origin, moveTo() would move it to world coordinates. I wondered how you could state this and tried to explain as simple as possible: the distance between an origin and other parts of an entity does, does matter, because it is the center of the origin that will get to the moveTo() point, the other brushes don't have to get to the same point, because they can be anywhere away from the origin brush.
In CoD2, when you do NOT define an origin brush...
You actually said exactly what I was saying in all my previous posts. Sorry if I expounded that in a poor way.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Elevator Script

Post by Drofder2004 » May 6th, 2013, 12:52 pm

megazor wrote:...
And this is where the misunderstanding is happening.

All movement actions made on an entity are about the origin, so if I say the brush will move to the world coordinates, then the I am directly referring to its origin - as a single entity, I feel it is not required to refer to the origin exclusively.

I assume from this that we are at a mutual understanding and all is dandu.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests