Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Papervision3D Essentials

You're reading from  Papervision3D Essentials

Product type Book
Published in Sep 2009
Publisher Packt
ISBN-13 9781847195722
Pages 428 pages
Edition 1st Edition
Languages

Table of Contents (18) Chapters

Papervision3D Essentials
Credits
About the Authors
About the Reviewers
1. Preface
1. Setting Up 2. Building Your First Application 3. Primitives 4. Materials 5. Cameras 6. Moving Things Around 7. Shading 8. External Models 9. Z-Sorting 10. Particles 11. Filters and Effects 12. 3D Vector Drawing and Text 13. Optimizing Performance

Setting a target with the lookAt() method


The lookAt() method enables you to make a camera look at a target. In this respect it behaves similarly to the previously discussed target property. However, besides target being a property and lookAt() being a method, there is a difference in how to use them. The target property needs to be set only once, for instance in the init() method, whereas lookAt() requires that you put it in the render method in order to keep being executed after the first frame is rendered. Therefore, to make the camera look at an object assigned to a variable plane, the following line should be added to the onRenderTick() method:

camera.lookAt(plane);

The camera will continuously rotate in such a way that its own z-axis is pointing at the origin of the target, as shown in the following illustration:

The lookAt()method is inherited from the DispayObject3D class. This means you can tell any do3D to look at any other do3D. So, you can't only tell a camera to look at a 3D...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}