Closed ffd8 closed 4 years ago
Nevermind! – perhaps this is best solved on the app level, since it needs to now how far out infront of the camera this infront
should be = based on app unit scale..
Edit: actually, just realized this might be useful in some way for a 3rd person POV... always nice to have toggle options between 1st + 3rd POV. But that's surely different code, since then the position stays the same and just the camera pulls back.
Another mechanism to employ might be ray casting. Instead of using the mouse coordinates like in the example, check for intersection between the Player.forward vector and the viewable objects in the application.
🤔 sounds interesting and wow, that's a wild example (link above was broken) – will give it a try, thanks!
Not sure if this relates to the library or is more for individual applications.. but would be nice if there was an easy way within the lib to calculate the space infront of the camera, especially taking into consideration the heading and position.
Here's a failed attempt built upon the maze demo. Was hoping to highlight just the single nearest block that is also being directly looked at. Seems like this could be really useful for any apps that want to interact with something in front of the player. Check line 88 of the sketch.js for attempt.. perhaps it needs to use
heading()
(which is for 2d calculations) rather than angleBetween? Maybe it's about a lib calculated variable calledfront
orinfront
which is the same dimensions as the camera, but always infront and rotates with the pan/tilt - so can then be calculated with distance from any object within the app?