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 JJNCreator · May 27, 2012 at 12:32 PM · camerarotationrotatefollowminimap

Minimap rotation

hey guys. i made a minimap in my scene. i want it to rotate when my character (which is in 3rd person) turns. i have this script that makes the minimap camera follow the character:

 using UnityEngine;

public class CameraFollow : MonoBehaviour {

     public Transform Target;
     
 void LateUpdate()
 {
     transform.position = new Vector3(Target.position.x, transform.position.y, Target.position.z);    
 }

}

i got the script from this Youtube video:

MiniMap tutorial

do u have any suggestions? thanks

Comment
Add comment · Show 2
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 JJNCreator · May 28, 2012 at 04:40 PM 0
Share

where in the script should i put it?

avatar image You! · May 28, 2012 at 05:23 PM 0
Share

after 'transform.position'

I am changing my first comment into an answer

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by jcooz · Jun 03, 2012 at 10:59 PM

I followed this tutorial as well and was looking for a way to rotate the camera. After some research on EulesAngles, I found the following line to solve this problem:

     transform.eulerAngles.y = Target.eulerAngles.y;

With the minimap camera facing down towards the terrain, this will set the camera to the exact angle as the character camera.

Comment
Add comment · Show 1 · 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 JJNCreator · Jun 07, 2012 at 07:11 PM 0
Share

can u copy and paste my script and put the code in the script then post it here? it would really help.

avatar image
0

Answer by You! · May 27, 2012 at 04:31 PM

 transform.rotation = new Vector3(0,Target.rotation.y,0)

after 'transform.position'

This would lead the code to looking like this:

 using UnityEngine
 public class CameraFollow : MonoBehaviour {
    public Transform Target;
 void LateUpdate()
 {
 transform.position = new Vector3(Target.position.x,transform.position.y,Target.position.z)
 transform.rotation = new Vector3(0,Target.rotation,y,0)
 }
 }
Comment
Add comment · Show 5 · 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 JJNCreator · May 28, 2012 at 06:16 PM 0
Share

im having trouble with it. can u copy and paste the camerafollow script have add your code in the right place and then put it on here? that would be helpful

avatar image You! · May 28, 2012 at 06:21 PM 0
Share
 using UnityEngine
 public class CameraFollow : $$anonymous$$onoBehaviour {
    public Transform Target;
 void LateUpdate()
 {
 transform.position = new Vector3(Target.position.x,transform.position.y,Target.position.z)
 transform.rotation = new Vector3(0,Target.rotation,y,0)
 }
 }
avatar image JJNCreator · May 28, 2012 at 09:10 PM 0
Share

im getting a compiler error saying that vector3 couldnt be turned into quaternion

avatar image You! · Jun 04, 2012 at 02:24 PM 0
Share

...Sorry I couldn't get back to you... I really don't know how to help you any further... I would listen to @jcooz.

avatar image Wolfram · Jun 04, 2012 at 02:47 PM 0
Share

You need to use transform.eulerAngles, not transform.rotation

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

6 People are following this question.

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

Related Questions

Camera rotation around player while following. 6 Answers

3D effect with new UI system 1 Answer

Rotate camera only in 2 directions based on player touch 1 Answer

Camera follow rotating ball 2 Answers

Replicate rotation of Camera 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