• 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 Felipetnh · Nov 16, 2014 at 08:56 PM · pivot-point

Rotate plane towards global position?

Hey guys, how are you? :)

Here's the thing. I have one plane inside my camera. The thing is: when some event gets fired, I need to rotate the bottom part of that plane towards a random global position.

My game is a 3D game, but the plane behaves as HUD for when my player gets shot by another player. And the plane shows where the hit came from. So I have a semi-circle as texture and need that texture to "point" to where the shot came from.

I have NO idea how to do that... Any help would be deeply appreciated. :) Let me know if you need anything from me in order to you guys help me.

Thanks!

Comment
Add comment · Show 1
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 b1gry4n · Nov 16, 2014 at 09:07 PM 0
Share

http://docs.unity3d.com/ScriptReference/Camera.WorldToScreenPoint.html

http://gamedevelopment.tutsplus.com/tutorials/positioning-on-screen-indicators-to-point-to-off-screen-targets--gamedev-6644

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by toddisarockstar · Nov 16, 2014 at 09:43 PM

 var lookpoint:Vector3
 var spinto = Quaternion.LookRotation(lookpoint - transform.position);
 
 function Update () { 
     spinto = Quaternion.LookRotation(lookpoint - transform.position);
     transform.rotation = Quaternion.Lerp(transform.rotation, troopspin, Time.deltaTime * 20);
 }

this should spin your plane to look at spinpoint if you attatch this to only the plane inside the camera.

else lookup the separate transform of the child plane through script if you want to spin it through the cameras script.

the plane should still follow the cameras position.

Comment
Add comment · Show 3 · 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 toddisarockstar · Nov 16, 2014 at 09:42 PM 0
Share

oops. troopspin needs to be spinto. I copy/pasted from one of my projects!

avatar image robertbu · Nov 16, 2014 at 09:45 PM 0
Share

@toddisarockstart - please format your code. After pasting, select your code and use the 101/010 button. I did it for you this time. Also add new information to your answer by using the comment button, not by adding a new answer. Thanks.

avatar image Felipetnh · Nov 16, 2014 at 11:18 PM 0
Share

Your solution doesn't really work for my purposes. Perhaps if I show you what I really want you can help me... :)

This is how it looks right now: alt text

And this is how it should look when I get shot (assu$$anonymous$$g that the box is where the shot came from) alt text

untitled-1.png (74.1 kB)
untitled-2.png (73.9 kB)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

28 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

changing the pivot/rotation point by script 1 Answer

Get sprite pivot point in world space 0 Answers

Instantiated Game Object is at the wrong location. 1 Answer

How could I make my camera move around a point during runtime? 1 Answer

Change RectTransform pivot without changing position 0 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