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 /
avatar image
1
Question by jorgon · Apr 02, 2012 at 11:18 AM · angleminimapelevation

Lock elevation angle for my object of the area of vision in my minimap

Hi!.

I've created a plane with an alpha .png and the transparent material which emulates the area of vision of my minimap.

How this area of vision starts and is attatched to my Ffirst Person Controller, I'd like to know how to eliminate the elevation angle which my area of vision heritages from my First Person Controller.

If I look up and down my area of vision in my minimap looks up and down (obviously) and this is what I want to supress: the elevation angle of my plane (area of vision)because it's represented in my minimap too.

Thank you in advance.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by aldonaletto · Apr 02, 2012 at 01:34 PM

I'm not sure about what you are actually doing, but if you're using a top-down camera, don't child it to the player: use a script to copy the player position to the camera, keeping a reasonable offset - like this (camera script):

var offset: Vector3 = Vector3(0,100,0); // camera 100m above player var player: Transform; // drag the player here var speed: float = 4.5; // how fast the camera follows the player

function LateUpdate(){ // LateUpdate is better for camera movement // copy the player position using Lerp to smooth a little the movement: transform.position = Vector3.Lerp(transform.position, player.position+offset, speed*Time.deltaTime); }

EDITED:

I thought you were trying to show the map as an image rendered from a top-down camera over the player.
If you just want the triangle to follow the camera direction, use the player's eulerAngles.y to get the angle:

var player: Transform; // drag the player here

function LateUpdate(){ // get the player angle about Y: angle = player.eulerAngles.y; // use the angle to define the triangle orientation } In the First Person Controller the camera only rotates up/down - the player rotates left/right and takes the camera with him, thus player.eulerAngles.y shows the current camera angle about Y.
Once you have this angle, you can rotate the triangle to the desired direction. I used this once to draw the player as an arrow texture over a mini-map, both rendered with GUI.DrawTexture, and used GUIUtility.RotateAroundPivot to rotate the arrow.

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 jorgon · Apr 03, 2012 at 02:30 PM 0
Share

Well, what I'm trying to do is which players could get better orientation through a STATIC $$anonymous$$imap. And I've implemented a triangle with a transparency degradated .png which acts as a Field Of View indicator whithin the $$anonymous$$imap attatched to the $$anonymous$$ain Camera of the First Person Controller. The map is Static and the only thing which moves inside it is the First Person Controller. I haven't understood what are you suggesting to me, sorry. :( . But thank you very much because it has a very good aspect your answer/suggestion.

avatar image aldonaletto · Apr 04, 2012 at 02:34 AM 0
Share

You can use player.eulerAngles.y to get the current camera angle about Y, and use it to set the triangle orientation - take a look at my edited answer.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Project an Angle onto a Plane (Turret Rotation) 2 Answers

Why does the raycast hit only objects/faces of a certain rotation? 1 Answer

How do I fire a 2D projectile based on it's current angle/location. 1 Answer

Clamp rotation 0 Answers

By-pass the 'shortest route' aspect of Quaternion.Slerp 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