- Home /
How to roll a ball with moving platform.
Hello iam trying to make a ball roll with the animated platform when the ball jumps on it. I added rigidbody to the ball and the platform also tryed addid physicsmaterial with friction that does not work and makes the ball roll other direction very fast or jump high in the air . What am I missing here? Platform inspector:
Ball(player) inspector:
Get the velocity of the platform and add it to the ball's current velocity...
You can't rely only on the physics to do the work as it won't work...
If you put a ball on a moving platform in real life, the ball will roll the opposite direction of the moving platform....
Hey thanks for info tried to do what you say but my platform in moving without velocity because i use animation to move platform. So i tried making a platform that moves with AddForce but then if i add that force to the ball it just flies off way to fast. But i found this that help my https://www.youtube.com/watch?v=O6wlIqe2lTA .
There is no need of an object to be rigidBody in order to measure velocity. You can do it with few lines of code:
// Private Variables
private float oldPos;
private float newPos;
private void FixedUpdate()
{
newPos = transform.position.x;
velocity = (newPos - oldPos) / Time.deltaTime;
oldPos = transform.position.x;
}
Answer by jbnlwilliams1 · Jul 07, 2020 at 08:29 AM
Try here
https://learn.unity.com/project/roll-a-ball-tutorial
jw,Contrary to what BonusBreaker did there, ther eis a tutorial for this.
https://learn.unity.com/project/roll-a-ball-tutorial
jw
I watched this tutorial there is no moving platforms it only tell how to make the ball move a ball and how to get collecting coins that rotate. So this didn't help.
Your answer
Follow this Question
Related Questions
rolling ball is a child that needs to be steered by parent 1 Answer
Ball rolling on platform 0 Answers
moving and jumping ball using physics 2 Answers
Bouncing ball stops when hitting edge of platform 2 Answers
How to make a ball that can roll? 2 Answers