- Home /
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
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!
Your answer
Follow this Question
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