Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookat component doesn't work with spotlight #1625

Closed
FrederickDesimpel opened this issue Jul 10, 2016 · 9 comments
Closed

lookat component doesn't work with spotlight #1625

FrederickDesimpel opened this issue Jul 10, 2016 · 9 comments

Comments

@FrederickDesimpel
Copy link
Contributor

A spotlight entity doesn't orient itself with a lookat component.

@FrederickDesimpel
Copy link
Contributor Author

FrederickDesimpel commented Jul 11, 2016

Looks like the threejs spotlight has a .target object by itself. That also explains why you can't set a spotlight's orientation.

Either the orientation and lookat components will have to take this into account ( which would nicely abstract this away from the user), or an additional component that sets this target is required.

Or maybe the light system can keep track of them.

@FrederickDesimpel
Copy link
Contributor Author

been playing a bit with a quick spottarget component... if the spotlight.target is added as a child of the light, and it's pos set to 0 0 -1 orientation works as expected ( with the spot pointed along it's -z axis)

@msimpson
Copy link
Contributor

I've been having some of these same issues when using SpotLight from THREE, in general. There seems to be a lot of confusion and discussion about using targets and both @BenJenkinson and @WestLangley left comments detailing a history of these issues here and here, respectively.

I don't know if that's going to be of any help, however.

@FrederickDesimpel
Copy link
Contributor Author

by adding the light.target to a given object, you get tracking for free :-)

I'm almost done with a component for (spot) light targets. Will have to check if it works for directional lights too, which also have a .target.

@ngokevin
Copy link
Member

ngokevin commented Aug 3, 2016

@FrederickDesimpel Would love if you could add a target property (type selector) for the light component.

@FrederickDesimpel
Copy link
Contributor Author

FrederickDesimpel commented Aug 4, 2016

I'll look into it. To have all the options you need a seperate component, but maybe the basics of it can be included in the light component yes.

Maybe tagetobject (selector) and a targetoffset, so you can also give a coordinate in worldpos (relative to scene if you don't specify an object.

And have it default to be added to the light itself, with an offset of (0 0 -1), so it looks down -Z ? and regular rotation works

been a while i worked on that... will have to see if all that can be added to light component in a clear way

All that being said, there is also still this issue

@FrederickDesimpel
Copy link
Contributor Author

or scratch that... just being able to set the target object is sufficient. You can always create an a-entity , hook that up and set the world position or any offset with that.

@FrederickDesimpel
Copy link
Contributor Author

Works like a charm now: #1728

@ngokevin
Copy link
Member

spotlight.target added, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants