• 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 Yogesh Pawar · Jun 10, 2013 at 08:08 AM · androidcameraball

Ball Character Movement Contrller

I am making my first game with pretty awesome Unity. I want to have my ball character controls like that in "Iron Wars" game for android. It's like the ball faces the direction of the joystick direction and moves forward by rotating in that direction. I have success in getting the input from virtual joystick. But when using force and velocity the ball moves in that direction but its face doesn't have any particular direction. I want to use physics for other tasks also so can't fake this by transform only. Also how to get that kind of top down camera view constantly facing the ball in middle of the screen. Help is much appreciated.:)

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

Answer by InfiniBuzz · Jun 10, 2013 at 09:37 AM

Hi

For the camera you can try to use the SmoothFollow camera script from the standard assets and modify the damping values.

Have you tried to use the character controller?

If you are using a sphere with a rigidbody I would rotate the sphere to the target. In what way do you think will this affect your other physics? How do you set the direction/point the ball should look at? Some kind of auto aim?

If you provide more detail its easier to help you.

Edit:

OK the ball character in the game you mentioned is made out of multiple objects, the "base ball" that is rotating and some kind of body/face. I guess you want to apply force to have the rotationg effect. I suggest you try to handle it using a charactercontroller or better create your own controller script and a wheel collider.

Your hierarchy should look like this

 Character (ControlScript and RigidBody)
     - Sphere (SphereCollider)
     - WheelCollider (Empty GO with WheelCollider)


then you can extend your character as you like.

In the controlScript you need to reference the wheelcollider and make it moving using wheelColliderVar.motorTorque = joystickInput (calculated with speed things and so on)

You are also able to rotate the whole char using joystick input and lookAt scripts.

Hope this is helpful

Comment
Add comment · Show 28 · 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 Yogesh Pawar · Jun 10, 2013 at 11:48 AM 0
Share

Thanks InfiniBuzz for your interest.

I am using virtual joystick to get the horizontal and vertical values between-1 to 1.

I meant that if i change the transformation values directly it will affect the physics.

Have a look at this Iron Wars game : http://youtu.be/$$anonymous$$HxqkaZ4NL0

I want same control scheme for my game.

avatar image InfiniBuzz · Jun 10, 2013 at 12:03 PM 0
Share

What physics? the character physics? I don't think the character (ball) in this video is moved by adding force/velocity to the ball

avatar image Yogesh Pawar · Jun 10, 2013 at 12:19 PM 0
Share

I want to add gravity to the ball character.

avatar image InfiniBuzz · Jun 10, 2013 at 12:31 PM 0
Share

Have you tried to rotate the ball so it faces the right direction? I think it shouldn't be a problem to manipulate the object while having physics affecting it.

avatar image Yogesh Pawar · Jun 10, 2013 at 12:37 PM 0
Share

Yeah i tried but then the ball doesn't rotate by applying the force.

Show more comments
avatar image
-1

Answer by NicoLocke · Jun 20, 2013 at 08:52 AM

Take a look at the marble ball game in here... might be what you're after.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 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

Related Questions

How to use Android Accelerometer(Left and right tilt) to turn a sphere object and camera in that direction? 1 Answer

ARCamera does not move with the phone 0 Answers

perspective camera into android 0 Answers

Switching from 3rd person to 1st person (Android) 1 Answer

Move a Game Object (Camera) forward and sideways with the Mobile Sensor Outputs. How? 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