Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
-1
Question by Gaming-Dudester · Nov 26, 2016 at 09:52 AM · rotationcamera rotateboundarything

Spinning camera help

How would i go about making a camera that spins when i push a button till 180 then When i push a button it spins till 0 then if i push the button again itll spin until it hits 180 and etc.

so far i have the spinning script and i said to make the camera rotation stop and when it hits 175-180 i made it equal 180 but sometimes it glitches through the 175-180 and it keeps going without stopping at that spot.

But If i slow down the camera itll look bad though. the current rotate speed is 200 with the basic rotate code line on it. Also i seperated this into small paragraphs so it wasnt all one big word jumble so dont go correcting me on language arts :)

Thanks for reading!

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 MCudlitz · Nov 26, 2016 at 12:13 PM 1
Share

If you posted your spinning code, we could help.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by JeffHardddyyy · Nov 27, 2016 at 05:29 PM

As @MCudlitz said, Posting your code will help us more than ever!

Without that, It's kinda a little bit "So, what are you doing ?" I get you're made it equal to 180,

But try looking into Quaternion

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 Gaming-Dudester · Nov 30, 2016 at 12:16 AM 0
Share

using UnityEngine; using System.Collections;

public class CameraScript : $$anonymous$$onoBehaviour { public float timespinningup,timespinningright,rad = 10.0f, SpinLagCatch;

 public GameObject CamCam;
 public bool isspinning;
 //int toggleheadspin = 0;

 public Quaternion poscamdark,poscamlight;


 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () 
 {


     if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Space)) 
     {
           isspinning = true;
         

     }
     if (isspinning == true)
     {
         
         CamCam.transform.Rotate (Vector3.up * (timespinningup * Time.deltaTime));
         CamCam.transform.Rotate (Vector3.right * (timespinningright * Time.deltaTime));

     



     }

     float camroty = CamCam.transform.eulerAngles.y;
     if (camroty >= 175f) 
     {
         if (camroty <= 180f) 
         {
             isspinning = false;
             CamCam.transform.rotation = poscamdark;
         }

     }
     if (camroty >= 355f) 
     {
             isspinning = false;
         CamCam.transform.rotation = poscamlight;
     }


// if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.A)) // { // CamCam.transform.rotation = poscamdark; // }

 }

}

i know my methods are doing things stink but idk :(

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

71 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 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 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

Look Left or right but keep walking forward 0 Answers

How do I make the camera look at three possible perspectives? 0 Answers

Problem with rotating player and last offset rotation 1 Answer

How to make camera rotate spherically around an object 0 Answers

Camera rotation with mouse cursor 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