|
Wyvern Petronius
Registered User
Join date: 10 Jun 2006
Posts: 4
|
06-20-2006 19:58
This code doesn't point my prim (a cone) at the sun, and I think it should. What's wrong with it? I stumped the on-line support person. point2Sun() { vector sun = llGetSunDirection(); llLookAt(sun, 1.0, 1.0); llSetTimerEvent(10.0); }
default { state_entry() { point2Sun(); } timer() { point2Sun(); } touch_start(integer num_detected) { llSay(0, "I point at the sun."); } }
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
06-20-2006 21:13
The vector parameter of llLookAt() is in region coordinates while the vector returned by llGetSunDirection() is a unit vector. You need to add your position in region coordinates to the vector returned by llGetSunDirection(): point2Sun() { vector sun = llGetSunDirection(); llLookAt(sun + llGetPos(), 1.0, 1.0); llSetTimerEvent(10.0); } And I think that you only need to put the llSetTimerEvent() in state_entry().
|