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 /
avatar image
0
Question by ohMyGames · Jan 23, 2017 at 02:42 PM · c#movementphysicscharactercontrollerquaternion

Player Control. Roller Ball with Cube Acceleration.

Roller Ball with Cube Acceleration.

I am having a difficult time solving this player control movement. I am new to scripting and although I feel like what I am trying to achieve is very simple, it has proven difficult for me. I am hoping the community can help out.

I am using the RollerBall scripts (Ball.cs and BallUserControl.cs) from the “Import Characters Package”. I have a cube placed on the top of the ball that currently does not spin when the ball moves left and right. I was able to achieve this with a script I am calling (Hat.cs). This is behavior is great but now I want to expand on this. I would like the ball and cube to feel like they are accelerating by rotating them together by 10 to 45 degrees counter to the rotation of the spin and player movement.

I have attached a .txt file with the 3 scripts I am using. link text

Thank you for your help alt text

playercontrol.jpg (182.3 kB)
roller-ball-with-cube-acceleration-scripts.txt (4.6 kB)
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 UnityCoach · Jan 23, 2017 at 09:58 PM

You want to use Animator Controllers for this kind of stuff.

Simply add an Animator Component to your object, then add a new Animator Controller to it.

Add an animation with just one keyframe with your object fully led back, and one with no keyframe.

Add a Float parameter "speed" to the Animator Controller.

Then, create a Blend Tree using those two animations, using the "speed" parameter to blend between the two.

Then in your script, set the float using animator.SetFloat () to the current speed.

You're done!

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

8-Axis 3D Top Down Movement 1 Answer

Making a bubble level (not a game but work tool) 1 Answer

How do I make my character controller jump when I use this code? 0 Answers

GetKey have delay when relesed [SOLVED] 1 Answer

How do I solve this error? 2 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