Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
02-01-2010 15:04
From llGetSunDirection (), how do I calculate the length of a shadow cast by an object of a given height?
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
02-01-2010 15:10
From: Pete Olihenge From llGetSunDirection (), how do I calculate the length of a shadow cast by an object of a given height? On a wall or on a floor?
_____________________
From Studio Dora
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
02-01-2010 15:38
Good point! On a floor.
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
02-01-2010 16:11
float poleHeight; float alpha = llRot2Angle( llRotBetween(llGetSunDirection(), < 0.0, 0.0, 1.0 >  ); float shadowLength = poleHeight*llTan(alpha); This will also compute when the sun is below the horizon. You must make a test for that situation if it matters to you
_____________________
From Studio Dora
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
02-01-2010 16:18
I was pretty sure tan came into it, but LSL doesn't appear have an llAtan function. There is llAtan2, which I've use to to find the direction the shadow should be pointing in, but I don't see how to apply it in this case, or even if I should try.
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
02-01-2010 17:23
Thank you Dora  I've really got to look at all those Rot functions - I guess they're nowhere near as scary as they seem at first glance.
|