Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jitin8 · Aug 10, 2016 at 03:20 PM · rotationrayarea

How can I calculate the area of projection while using a projector component?

I need to simulate a projector on a platform in order to project an image on a wall and I am using the projector component for the same. I have the coordinates for the centre of the projection and have set the FOV and aspect ratio to the required values. Now I need to determine the exact area of the obtained projection for some testing and validation purposes. Is there any simple or direct way to get this from the projector component?

I also tried detecting the 4 corner points of the projection by rotating the ray drawn from the projector location to the centre of projection. As I understand, simultaneous rotation would be required around 2 axes in order to rotate a ray to face a corner of the projection. I haven't worked much with graphics or unity before, but I tried to rotate the ray using the following code:

 Quaternion rotationBR = Quaternion.AngleAxis (horizontalFOV / 2f, transform.up) * Quaternion.AngleAxis (FOV / 2f, transform.right);
         Vector3 BR = rotationBR * projectionCentreDirection;
         Ray ray1BR = new Ray(destination, BR);
         Vector3 pointBR = destination;                                //TO CHANGE
         if (Physics.Raycast (ray1BR, out hit, 100f, layerMask)) {           
             pointBR = hit.point;
         }

The corner point obtained using the above code was very slightly off the corner of the actual projection. I think that might be due to the rotations taking place one after the other. Could someone kindly explain how I could correct the slight error in the coordinates of the corner point? Any help would be greatly appreciated.

Thanks and regards JT

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Using Camera screen point to ray for look rotation problem... 1 Answer

3rd person 3D aiming 1 Answer

Test if rotation of two go matches 1 Answer

Rotation of Object on single axis in direction of the mouse position 0 Answers

How do I make sure that a ray ALWAYS points straight down? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges