Hello,
I have a Ball sprite and a Floor sprite. The Ball has a Rigidbody 2D and is controlled by the player with this script:
using UnityEngine;
using System.Collections;
public class Ball : MonoBehaviour {
public float xSpeed = 4;
void FixedUpdate () {
float inputX = Input.GetAxis ("Horizontal");
if (inputX != 0)
{
rigidbody2D.AddForce(new Vector2(inputX * xSpeed, 0));
}
}
}
When the Ball moves on the Floor it doesn’t decelerate. How can I add friction to the Ball on the Floor so that it decelerates till stopping, after a force has been applied to it?
Thank you in advance! ![]()
