Report this content
We want the Dreams coMmunity to be a safe, diverse and tolerant place for everyone, no matter their age, gender, race, sexual orientation or otherwise. If you believe this content to contradict these principles, you can file a report for our coMmunity teams to investigate.
Note that misuse of the reporting tool will not be tolerated.Item being reported:
I want to ensure that no matter where the camera moves in a horizontal plane, that certain objects are always front-facing the camera (not pointing at the camera but parallel to its viewing plane). So if my camera is looking at Face A of a cube, and it rotates around the cube to the right, the cube will rotate too so that the camera is always looking at Face A (and never sees any other side of the cube). However this was assuming the camera was centered on the cube, if the cube is off center screen, then the camera would see the side of the cube, but the camera face is still parallel to Face A.
I solved for this last night and just have to implement it now.
The Orientation values from sensors are converted to be in the range of 0-360deg (they are normally 0 to 180 and -0 to -180).
The camera's 0-360 orientation is broadcast to the watcher objects, who also have their own 0-360deg orientation. The camera orientation is the destination, and the watcher's orientation is the source position.
We can get the absolute value of the difference between the destination and source to determine the degrees between them within the 0-360deg range.
If the abs difference is <= 180 and source is < destination then we will rotate CounterClockwise to the destination.
If the abs diff is <= 180 and source is > destination then we will rotate Clockwise to the destination.
If the abs diff is > 180 and source is < destination then we will rotate Clockwise to the destination.
If the abs diff is > 180 and source is > destination then we will rotate CounterClockwise to the destination.
So basically what is happening is that the Watchers are listening to the Orientation of the Camera, and rotating themselves the shortest possible distance to match the orientation of the camera. If they orientations match, they are not rotating. If they orientations dont match then they are rotating. Hopefully with enough rotational speed the effect will look mostly seemless....tbd.
Perhaps there is still an easier way to achieve a similar visual though.