Page 1 of 1
Visualize the worlds axis!
Posted: Wed Mar 02, 2005 11:21 pm
by Bjarne BZR
After trying to place a spawned model correctly over a clip I had to hide in an SP map I'm making into OBJ, I got this elegant idea:
...I used spawned func_beams to visualize the X Y and Z axis in the world, and suddenly it took no tima at all to place the model, because by looking at the 3 lines I can pretty quickly say if it should be moved about -50 in X, and +30 in Y
Not really any rocket science, but very useful if you like scripting stuff into a map.
The code:
Code: Select all
debug_draw_axis local.origin:
local.beam_end = ( local.origin + ( 100 0 0 ) )
local.beam = spawn func_beam origin local.origin endpoint local.beam_end maxoffset 0
local.beam doActivate
local.beam color (1 0 0)
local.beam_end = ( local.origin + ( 0 100 0 ) )
local.beam = spawn func_beam origin local.origin endpoint local.beam_end maxoffset 0
local.beam doActivate
local.beam color (0 1 0)
local.beam_end = ( local.origin + ( 0 0 100 ) )
local.beam = spawn func_beam origin local.origin endpoint local.beam_end maxoffset 0
local.beam doActivate
local.beam color (0 0 1)
end
And how to draw it:
No need to place it in ( 0 0 0 ), in the image above I used:
Code: Select all
thread debug_draw_axis ( -2801.40 -3280.21 259.46 )
Posted: Wed Mar 02, 2005 11:40 pm
by Elgan
im pretty sure their is a cvar for this sowwy. ive seen cvars that spawn random lines and arrows but they always crash mohaa when u reoad so script can be better. nice lil thing though. nice work:P cudnt u put lil x,y's and z's on em:D for show:P
Great
Posted: Thu Mar 03, 2005 12:41 am
by Pollo_Expresss
Hey, that?s great.
Recently i?ve been spawning models in stock maps and now I?ll be faster when doing the job, hehe.
Great idea Bjarne, thanks for sharing it.
Well, now I have a question that have to do with that.
You called the thread giving it an argument. Can I do the same but giving a thread three arguments?
I mean if I want to spawn three models of the same .tik file, will this work?
Code: Select all
spawn_bikes local.originx local.originy local.orignz:
local.bike = spawn models/vehicles/bmw.tik
local.bike.origin = ( local.originx local.originy local.originz )
blah blah blah and scale, hide or solid stuff
And then call it like that:
Well, just now I?ve noticed that I should try it and then ask it, but hehe, if someone had tried it before he could tell us.
Thanks again Bjarne.
Posted: Thu Mar 03, 2005 8:48 am
by Bjarne BZR
Sure you can have 3 parameters to a function, but in this particular case it is not nessesary. You can just send the locatin as a vector like I did:
Code: Select all
spawn_bike local.origin:
local.bike = spawn models/vehicles/bmw.tik
local.bike.origin = local.origin
// blah blah blah and scale, hide or solid stuff
end
... but there is no problem doing it like you sugggested either:
Code: Select all
spawn_bike local.X local.Y local.Z:
local.bike = spawn models/vehicles/bmw.tik
local.bike.origin = ( local.X local.Y local.Z )
// blah blah blah and scale, hide or solid stuff
end
Calling difference is small, but I think mine:
Code: Select all
thread spawn_bikes ( 1200 -300 35 )
...is more obvious as to what the parameter is ( a vector ) than your version:
But they both do the exact same thing.
Posted: Thu Mar 03, 2005 8:51 am
by Bjarne BZR
Elgan wrote:cudnt u put lil x,y's and z's on em:D for show:P
Yes I could, and arrows at the end of the lines, and a sparkling blue star at the worlds origin
But I made it to save time, not to waste it by winning an art award...

Posted: Thu Mar 03, 2005 9:17 am
by Elgan

lol
Color of script objects?
Posted: Sun Mar 06, 2005 11:10 am
by Pollo_Expresss
Sorry about refreshing this post, but I have a question that have to do with this, hehe.
Is there anyway for giving a script_object a color like in Bjarne?s code he did with func_beam?
I tryed something like that:
Code: Select all
local.mywall = spawn script_object
local.mywall = blah, blah, origin and setsize stuff
local.mywall color (1 0 0)
And like that:
Code: Select all
local.mywall = spawn script_object
local.mywall = blah, blah, origin and setsize stuff
local.mywall.color = (1 0 0)
And it doesn?t seem to work, I guess it?s possible that what I ask can?t be done, but if someone knows the answer it?ll be apreciated.
Thanks.
Posted: Sun Mar 06, 2005 11:25 am
by Bjarne BZR
I dont think there is anything in a script_object that you can give a color... The beam has shaders attached to it and can be colored or textured.
Not saying it is impossible, just that I don't know how to do it.
Re: Color of script objects?
Posted: Sun Mar 06, 2005 11:44 am
by Grassy
Pollo_Expresss wrote:Sorry about refreshing this post, but I have a question that have to do with this, hehe.
Is there anyway for giving a script_object a color like in Bjarne?s code he did with func_beam?
Dont think so, but you could apply a light to it.
local.ent light 0 0 1 50 // = blue
local.ent lighton