Setting Camera Target
-
Prerequisite
Description
Every camera has a target point that it looks at. This point is invisible, but you can change it by providing the x/y/z positions of a new target point.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d34819dd-9ec2-4150-9477-e5e2f12d757c.png" width="400" style="filter: drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5));">
Demo
In this program, we first add 3 boxes at x positions of -150, 0 and 150. then we add a new orbit camera. By default the camera would be looking at the origin point (x = 0).
When we change the camera’s target point to be x of -150, it is shifted left to look at the green box on the left. Similarly, when the target x is 150, the camera looks at the pink box on the right.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/fdff41e4-6493-4edc-992a-5a57bbed1726.gif" width="900" style="border-radius: 5px; border: 1px solid #29622d;">
Try it yourself:
https://play.creaticode.com/projects/4b0759677c498e7a48f581c5
Learn More
-
I CreatiCode pinned this topic on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login