Light_origin
taleden
Join Date: 2003-04-06 Member: 15252Members, Constellation
Can anyone verify whether the light_origin field actually works? Just now I was working on blocking light in a particular way by building an opaque func_wall. I started out with the func_wall in the position I needed it in to cast the right shadows, to make sure it was going to have the effect I wanted, and it did (I'm using a beta test copy of Cagey's next build, which fixes the opaque entity problem). So then I set the entity's light_origin to point to the center of the entity in that position : "0,576,-240", and moved the entity. When I compiled again, the entity no longer blocks light the way it did when it was physically there.
Has anyone ever used light_origin successfully to have an entity cast a shadow from a position other than the one it's physically in? If so, what syntax did you use for the light_origin value? Maybe the coordinate triplet I put in wasn't what it was looking for.
Thanks for any help
-tal
Has anyone ever used light_origin successfully to have an entity cast a shadow from a position other than the one it's physically in? If so, what syntax did you use for the light_origin value? Maybe the coordinate triplet I put in wasn't what it was looking for.
Thanks for any help
-tal
Comments
Has anyone ever used light_origin successfully to have an entity cast a shadow from a position other than the one it's physically in? If so, what syntax did you use for the light_origin value? Maybe the coordinate triplet I put in wasn't what it was looking for.
Thanks for any help
-tal<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
from the source code, it appears that "light_origin" works in tandem with a "model_center" key:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->// Allow models to be lit in an alternate location (pt1)
if (*(s = ValueForKey(ent, "light_origin")))
{
entity_t* e = FindTargetEntity(s);
if (e)
{
if (*(s = ValueForKey(e, "origin")))
{
double v1, v2, v3;
if (sscanf(s, "%lf %lf %lf", &v1, &v2, &v3) == 3)
{
light_origin[0] = v1;
light_origin[1] = v2;
light_origin[2] = v3;
b_light_origin = true;
}
}
}
}
// Allow models to be lit in an alternate location (pt2)
if (*(s = ValueForKey(ent, "model_center")))
{
double v1, v2, v3;
if (sscanf(s, "%lf %lf %lf", &v1, &v2, &v3) == 3)
{
model_center[0] = v1;
model_center[1] = v2;
model_center[2] = v3;
b_model_center = true;
}
}
<snip> ... </snip>
// Allow models to be lit in an alternate location (pt3)
if (b_light_origin && b_model_center)
{
VectorSubtract(light_origin, model_center, origin);
}<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
If you don't specify a model_center, the origin recalculation for lighting doesn't take place. The source doesn't indicate how long it's been done this way.
Pwetty please? *bats eyelashes*
Of course, if coordinates are made possible then that would probably be sufficient to handle any placement at all, so maybe this other functionality would be redundant. *shrug* Just an idea. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->