You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><em>attach_light</em> creates a <em>local_light</em> and binds it to a moving object.</p>
<p><aclass="reference external" href="https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/BoxLightTest">An example may be seen here</a>.</p>
<dlclass="py function">
<dtclass="sig sig-object py" id="attach_light">
<spanclass="sig-name descname"><spanclass="pre">attach_light</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">ball</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">offset</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">vec(3,</span><spanclass="pre">0,</span><spanclass="pre">1)</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">color</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">color.green</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#attach_light" title="Permalink to this definition">¶</a></dt>
<li><p><strong>firstargument</strong> (<em>object</em>) – Object to which to attach the <em>local_light</em> (<em>ball</em> in example above).</p></li>
<li><p><strong>offset</strong> (<em>vector</em>) – Displacement of light from the center of the moving object. Default <0,0,0>.</p></li>
<li><p><strong>color</strong> (<em>vector</em>) – Default is the color of the object to which the light is attached.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<p>It is possible to attach more than one light to an object.</p>
<p>The offset may be thought of as an invisible rigid rod connecting the moving object and the local_light, so if the object rotates the local_light will rotate around the moving object.</p>
<p>If you specify a zero offset for a sphere, you will find that the local_light does not affect the lighting of the outer surface of the sphere; it does of course affect the lighting of objects outside the sphere. In this case you may wish to specify ball.emissive = True, which makes the ball seem to glow.</p>