aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.59k stars 3.94k forks source link

[CLOSED] support rotation="lookAt(0, 0, 0)" #637

Closed ngokevin closed 8 years ago

ngokevin commented 8 years ago

Issue by ngokevin Monday Nov 16, 2015 at 18:42 GMT Originally opened as https://github.com/aframevr/aframe-core/issues/447


Would be nice to be able to have an object face a point without having to do calculations. For example, if we wanted things aligned in a circle, we could tell each object to look at the center of the circle.

ngokevin commented 8 years ago

Comment by dmarcos Monday Nov 16, 2015 at 19:06 GMT


What happens if the circle moves? It would be better to have a look-at component where you pass a selector:

<vr-object look-at="#circle"></vr-object>
ngokevin commented 8 years ago

Comment by ngokevin Monday Nov 16, 2015 at 19:10 GMT


i like passing in a selector. might cause problems if someone specifies both look-at + rotation? since look-at modifies rotation, it makes sense that the rotation component handle both

ngokevin commented 8 years ago

Comment by dmarcos Monday Nov 16, 2015 at 19:15 GMT


We already have this problem with controls. Controls modify rotation and position and can collide with other changes. You can isolate changes by wrapping elements in other elements.

ngokevin commented 8 years ago

Comment by dmarcos Monday Nov 16, 2015 at 19:16 GMT


This is going to happen with components that apply behaviours on entities.

ngokevin commented 8 years ago

Comment by ngokevin Monday Nov 16, 2015 at 19:22 GMT


yeah though there's not much we can do with controls. but it might be good API design to put look-at functionality in rotation component. it:

  1. reinforces to the user that look-at affects rotation
  2. adds a constraint so the user cannot specify both on the same entity
  3. decreases api surface area

but i do see the case for code modularity.

ngokevin commented 8 years ago

Comment by jcarpenter Wednesday Nov 18, 2015 at 10:45 GMT


Dupe of #317, I think.

Enables devs to tell objects to "look at" another object. This is common and extremely useful. Implementation could be via component, with something like: <a-kitten lookat="target: bird"> Example from Cinema 4D's implementation is as follows: https://dl.dropboxusercontent.com/u/667711/mockups/target-example.mov

In C4D Look At tag takes priority over (ignores) standard object transforms.

ngokevin commented 8 years ago

Comment by jcarpenter Wednesday Nov 18, 2015 at 10:46 GMT


Primary use case for this is UI design, IMO.

ngokevin commented 8 years ago

Comment by ngokevin Wednesday Nov 18, 2015 at 18:05 GMT


Dupe https://github.com/MozVR/aframe-core/issues/317

Changed my mind, I'm okay with lookat separate component