Jump to content

Calculating rotation from direction


DigiHz Data
 Share

Recommended Posts

Actually, it's normal that the computed rotation is wrong when you align the stop with the initial world axis chosen to compute the first cross vector (please read carefully this sentence).

The example Adam and I gave to you was in order to make you understand how this works. We don't do your work, we give you snippets, hints and explanations. Then please, take the time to read the code and try to understand it.

I can give another hint : as you can't always compute the spot rotation from the cross product with one of the world axis (in case the spot direction is collinear with this world axis), I would

- either test if the light direction is collinear with the world axis and get another one (say, Y instead of X) if this is the case before computing the first cross product

- either use another approach what would be to compute the light direction from the spot orientation

up to you ;)

Link to comment
Share on other sites

@jerome

I thank you for trying to explain to me.

I give it a try later on then when i have learned to be a proffesional about matrixes, upvectors, and what more that is needed.

The solution is not ment for only me, but for all that is using BJS.

Meanwhile....

A PG for point lights.

http://www.babylonjs-playground.com/#18TRYT

Link to comment
Share on other sites

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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