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 Henry90 · Mar 07, 2013 at 11:49 PM · cameracharactercontrollerorbitmouseorbit

Character controller and MouseOrbit Camera(don't work togheter)

Hi guys, sorry for my English. I will try to explain you my problem. I have my Player (a ball) with a Character controller attached and a CharacterController.Move() script attached as well. I have a Main Camera with the mouseOrbit script attached. My Main Camera looks, of course, at my Player. The problem is: when I start the game my camera starts to shake up and down continuously. And I don't know how to solve this problem. Can you please help me? Thank you!

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Mar 08, 2013 at 03:02 AM

I just put the character controller script and the mouse orbit script together in a scene, and they worked just fine. No shaking. I was using a mouse for controlling the camera and a game controller for controlling the character. As a guess, the problem you face may be because you are trying to use the mouse for both camera movement and character movement. Given your original question, my guess is that you want to use the keyboard for controlling the character? If so, change the character controller script you copied from the script reference so that the motion and turning of the character are controlled by the keyboard and then see how well you thing the two scripts work together.

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 robertbu · Mar 08, 2013 at 08:26 AM 0
Share

I changed the sample script at CharacterController.$$anonymous$$ove() to use arrow keys. I had no issues when I combined it with the mouse orbit script:

 using UnityEngine;
 using System.Collections;
 public class CharHandler : $$anonymous$$onoBehaviour {
     public float speed = 1000.0f;
     public float jumpSpeed = 11.0f;
     public float gravity = 20.0f;
     public float dragFactor = 0.92f;
     public float rotationSpeed = 10.0f;
     private Vector3 moveDirection = Vector3.zero;
     void Update() {        
         CharacterController controller = GetComponent<CharacterController>();
         if (controller.isGrounded) { 
             
             if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.LeftArrow))
                 transform.RotateAround (Vector3.up, -rotationSpeed * Time.deltaTime);        
             if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.RightArrow))
                 transform.RotateAround (Vector3.up, rotationSpeed * Time.deltaTime);    
             
             moveDirection = Vector3.zero;
             
             if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.UpArrow))
                 moveDirection += transform.forward * speed * Time.deltaTime;
             if (Input.Get$$anonymous$$ey ($$anonymous$$eyCode.DownArrow))
                 moveDirection += -transform.forward * speed * Time.deltaTime;
             
             if (Input.GetButton("Jump"))                
                 moveDirection.y = jumpSpeed;                    
         }   
         moveDirection.y -= gravity * Time.deltaTime;        
         controller.$$anonymous$$ove(moveDirection * Time.deltaTime);    
     }
 }
avatar image
0

Answer by anderson616 · May 01, 2017 at 03:13 PM

It's been a long time but the solution is simple, just check the IsKinematic option in RigidBody that stops this madness.

Comment
Add comment · 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

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

11 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

Related Questions

Orbit Camera on Survival Shooter Sample Project 0 Answers

Rotate camera to object on sphere 1 Answer

Getting a scrolling camera to orbit around a circular walkway, following the player? 1 Answer

WASD Controls not in-sync with camera? 1 Answer

How do I create a camera similar to the one in th room of shadows example? 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