Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Jun 27, 2014 at 04:39 PM by Griffo for the following reason:

Found the reason why ..

avatar image
0
Question by Griffo · Jun 27, 2014 at 01:26 PM · raycasthit.point

Orientate a quad to the ray cast hit.normal

Hi, what I'm trying to do is when the ray cast id fired I want to place a quad with a texture on it at the hit.point so for testing I tried

 Instantiate (prefab, hit.point, Quaternion.LookRotation(hit.normal));

So when the ray cast is fired the quad is placed at the hit.point but the quad is always 180 degrees the wrong way to see the texture?

Comment
Add comment · Show 3
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
avatar image HarshadK · Jun 27, 2014 at 01:46 PM 0
Share

Ummm... The normal of your quad may be pointing in the opposite direction?

avatar image Griffo · Jun 27, 2014 at 02:00 PM 0
Share

it's a Unity quad ..

alt text

screen shot 2014-06-27 at 15.00.06.png (131.2 kB)
avatar image Griffo · Jun 27, 2014 at 02:11 PM 0
Share

Yes it's the Quads norms .. using a plane works fine.

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by HarshadK · Jun 27, 2014 at 02:13 PM

I just checked it out and found in order to make a quad get oriented in right direction you need to use:

 Instantiate (prefab, hit.point, Quaternion.LookRotation(-hit.normal));

Don't know why but flipping the normal direction works for a quad. Might be because how quads work because for other types of objects you need to use the hit.normal itself.

Comment
Add comment · Show 2 · Share
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
avatar image Owen-Reynolds · Jun 27, 2014 at 02:45 PM 2
Share

Look at Griffo's screen shot. It shows that the quad faces negative z. If you look at the other, +z, side, there's nothing -- most materials use a 1-sided shader. I assume this was done so you can place a plane the usual way, with +z being world +z, and be able to see it w/o any rotation needed.

In general, the front of an object could be +y or any odd thing. Some people always use childing to make the front be +z. If not, have to use something like Quat.LookRot(normal)*Quat.Euler(90,0,0).

avatar image HarshadK · Jun 27, 2014 at 06:07 PM 0
Share

Now I got it. Thanks @owen for insightful comment.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Moving gameobject along terrain based on player movement using raycast 1 Answer

Raycast.hitpoint always returning back to the camera 0 Answers

RayCast Help 1 Answer

Linecast between character and camera doesn't ignoring Characters collider. 2 Answers

Strange Behavior with Hit.point 1 Answer


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