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
0
Question by LSnake2001 · Aug 03, 2010 at 09:36 PM · camerarotationtransformteleport

Simplist way to rotate camera 180degrees on trigger?

Hi,

I'm trying to set up a series of teleporters in my scene that adjusts the fps camera's position and rotation. I've set up the change of position with no problems but can't get my head around rotating the camera on trigger by 'x' amount.

Here's my code so far:

var Camera_01 : GameObject; var Destination : Transform;

function OnTriggerEnter (other : Collider) { Camera_01.transform.position = Destination.transform.position; Debug.Log ("warping..."); }

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 Mike 3 · Aug 03, 2010 at 10:28 PM 0
Share

Use the code button (the one with 0s and 1s on) ins$$anonymous$$d of using pre and code tags. Just select your code, hit the button and done

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Mike 3 · Aug 03, 2010 at 10:26 PM

It should (hopefully) just be as simple as this:

Camera_01.transform.rotation *= Quaternion.Euler(0, 180, 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 Yves · Aug 04, 2010 at 01:38 PM 0
Share

What is the purpose of the * character just before the equal sign??

avatar image Mike 3 · Aug 04, 2010 at 02:09 PM 0
Share

It's multiply equals (multiply by, then assign back). In the case of quaternions, the multiply operator is used to rotate one quaternion by another

avatar image LSnake2001 · Aug 05, 2010 at 08:48 PM 0
Share

Hi $$anonymous$$ike, thanks for the reply. I thought I was displaying the code wrong in the message too!! Thanks for clearing that up. The code you gave me didn't seem to work. Is there anything that could be conflicting with the script?

avatar image Mike 3 · Aug 05, 2010 at 09:14 PM 0
Share

It's very possible that if you're using the $$anonymous$$ouseLook script or something like that, it could mess about with it

avatar image LSnake2001 · Aug 08, 2010 at 09:06 PM 0
Share

That may be what is happening as I'm using a fps controller with $$anonymous$$ouseLook attached to it. Can you recommend a better way of doing this? Would it be worth using LookAt and telling the camera to look at something behind it on teleport?

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

No one has followed this question yet.

Related Questions

Quaternion Slerp Sanity Check 1 Answer

transform.Rotate For an Certain Amount of Time 1 Answer

FPS, character arm movement 0 Answers

How to transform position? 2 Answers

Locking world rotation of child 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