spotlight trace
Moderator: Moderators
spotlight trace
I have created a map with two spotlights bound to a crane that move with the crane . I see by the spotlight script that the spot on the ground seems to follow a script origin that is flying a path . What I want to know is if you can do a trace or something of the angles the spot is on to determine where on the ground that the light is hitting so that you can spawn a light and corona at that spot like the game spotlights . My lights angles are fixed so they only move when the crane moves and do not change angles the angles are dertermined by the crane . the game moves the spots to the targets but I want to move the targets to the spots .
This might be what you're looking for:
trace <vector start> <vector end> [int pass_entities ] [vector mins] [vector maxs]
Performs a Trace Line from the start to the end, returns the end or the position it hit at
For example, if you want to trace from $a to $b, type:
local.c = trace $a.origin $b.origin
local.c will now be the vector where the trace ended. If nothing is between $a and $b, local.c will be equal to $b.origin.
Mins and maxs allow you to define the bounding box within the trace should be calculated. pass_entities is the number of entities to ignore when tracing (sloppy
).
trace <vector start> <vector end> [int pass_entities ] [vector mins] [vector maxs]
Performs a Trace Line from the start to the end, returns the end or the position it hit at
For example, if you want to trace from $a to $b, type:
local.c = trace $a.origin $b.origin
local.c will now be the vector where the trace ended. If nothing is between $a and $b, local.c will be equal to $b.origin.
Mins and maxs allow you to define the bounding box within the trace should be calculated. pass_entities is the number of entities to ignore when tracing (sloppy
I still don't see . To do a trace from the light in the direction of that lights angles I need a second point that is in a direct line to that lights angles and far enough away so that the trace hits the map . (0 0 1000) whould make the second point 1000 units directly above the first point , is that right ? . Do you get what I want to do I want to follow the searchlights angles until it hits the map and then at that point spawn a second light that is the spot that the light makes when it hits the ground and then make a carona around that . Then as the crane moves I need to move the light and carona to the new spot on the map that the light will hit if you follow it on its angles . I mave have missread the global/spotlight script but I think it creates a script origin and has it fly a path and moves the light to the script origins origin . The three coordinates of the origins offset are (forward/back , left/right , up/down ) is that right ? .
I mean is ( 0 0 1000 ) 1000 units above the objects origin regardless of the angles the object is on ? If the object is a spotlight pointing down at the ground and it where to point upward would a$.origin + (1000 0 0 ) be the same point in space .
I mean is ( 0 0 1000 ) 1000 units above the objects origin regardless of the angles the object is on ? If the object is a spotlight pointing down at the ground and it where to point upward would a$.origin + (1000 0 0 ) be the same point in space .
The origin variable is a xyz vector regardless of angles. If you want to spawn
a script_origin in line with the spotlight, lets say 1024 units off, use:
local.a.origin = local.light.origin + local.light.forwardvector * 1024
In this example local.a is the generated script_origin and local.light your light with an angles key. If your spotlight points slightly down, the origin will be created slightly down as well 8). So I think this is what you need.
a script_origin in line with the spotlight, lets say 1024 units off, use:
local.a.origin = local.light.origin + local.light.forwardvector * 1024
In this example local.a is the generated script_origin and local.light your light with an angles key. If your spotlight points slightly down, the origin will be created slightly down as well 8). So I think this is what you need.
that did it I created a script origin in line with the spotlight although I had to use -1024 . I guess the spots forward vector is to the back away from the light . I then used trace to find the spot on the ground that the light will hit . There I created a script model fxdummy.tik and gave it a light value ( 1 1 1 ) . I am still tweaking it to back the light up a bit so that it is not partway though a brush and I tried a flare and also a corona . Niether of which I liked because they shine through other brushes and don't look quite right but will play with scale etc I may change my mind . I know the spotlight.scr uses the corona but in my map doesn't look good too bright like a small star .
