Jump to content

How to set target or position of lights?


Recommended Posts

Hi hit... that is not a noob question... no need to apologize. 

Direction vectors are sometimes difficult to understand.  But .position vectors for lights... is easy, though.  It works the same as mesh .positions.  With Z-facing camera (common)... X is left/right, Y is up/down, and Z is forward/backward. 

I will soon write a helper section in our Lights Tutorial... about directions.  Perhaps I will give a copy to @JohnK for HIS Lights Tutorial, too.  :)

For now, know that there is a method:   light.setDirectionToTarget(something.position) ...that will help you.

Hemi lights almost always aim straight up... direction 0, 1, 0 and their .position is usually 0,0,0 (scene center) and rarely changed.

SpotLights and DirectionalLights are the lights that MOST USE  .setDirectionToTarget().  THEIR .position is VERY important... because their .position is used for shadows creation.  PointLights also have important .position for same shadow reason, but a pointLight is ALL-direction.  :)

I am hurried now, but you can put camera and spotlight inside doubleside box... and experiment aiming spotlight with setDirectionToTarget()... and then checking console.log(spotLight.direction).  You will learn direction vectors fast... when doing that.  Good luck... I'll be back later.  Hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...