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 Wolferino · Aug 30, 2014 at 08:02 PM · c#camerarotationcamera rotatesphere

Third person follow camera on a sphere

I'm new to unity and I'm trying to get the hang of it, I'm following this tutorial http://unity3d.com/learn/tutorials/projects/roll-a-ball to try and create movable ball similar to monkey ball. I've created a camera that is following the sphere using this code:

 public class FollowCamera : MonoBehaviour {
     public GameObject target;
     public float damping = 1;
     Vector3 offset;
      
     void Start() {
         offset = target.transform.position - transform.position;
     }
      
     void LateUpdate() {
         float currentAngle = transform.eulerAngles.y;
         float desiredAngle = target.transform.eulerAngles.y;
         float angle = Mathf.LerpAngle(currentAngle, desiredAngle, Time.deltaTime * damping);
          
         Quaternion rotation = Quaternion.Euler(0, angle, 0);
         transform.position = target.transform.position - (rotation * offset);
          
         transform.LookAt(target.transform);
     }
 }

While this works correctly and follows the sphere, the controls are very awkward and do not work as expected however if the sphere is changed to a cube or anyother model its works perfectly fine.

Also if anyone has any sites to get me started that would be nice of you.

Thanks

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
0

Answer by Wolferino · Sep 02, 2014 at 02:52 PM

bumperino

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 GameVortex · Sep 02, 2014 at 02:58 PM 0
Share

The Irony here is that you posted your bump as an Answer which means your question will be removed from the Unanswered section making it even more unlikely to get any answers on it.

Ins$$anonymous$$d of bumping your questions you should think about why your question may have gone unanswered. With this question you have not provided enough details.

You say it does not work as expected. You should then provide us with details about how it should work, why you think what you have done would work and what exactly it does wrong. Saying the controls are awkward give us nothing I am afraid.

If you want some tutorials then Unity has a ton of them: http://unity3d.com/learn/tutorials/modules But you have probably already been to that site.

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

2 People are following this question.

avatar image avatar image

Related Questions

Flip over an object (smooth transition) 3 Answers

maximum angle for camera 0 Answers

Limit camera RotateAround for an UAV game 0 Answers

Rotating following camera for a sphere 1 Answer

Coding noob struggles to implement first-Person camera rotation. 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