# Frictionless physics

We are trying to create an educational game that only has very basic physics. Friction should be rejected. But somehow, objects still slow down when we put them in a half-pipe of planes.

Also, colliding two objects against one another will stop them both. As in: they absorb all energy, instead of bouncing back.

This are both two phenomenons that I cannot think of with my basic physics knowledge.

So my general question is: How do I make a physics system with the rigid bodies in unity that will keep all energy during collisions, instead of stopping the objects?

EDIT:
It seems that what I’m doing with the physics is not exactly how it works in physics. The problem is: I try to let my ball roll from a slope. The sharp angle that is made with the ground makes the ball lose energy. This is actually quite logical.

So I’m actually looking for a way to keep all energy in the ball when colliding against a wall.

Create a physics material, set its friction to 0 and its bouncyness to 1

As well as making the physics material and setting the bouncyness to a high value (1 will do crazy things), you need to remove drag from the equation, as this will make everything slow down. This is done on the rigidbody itself, not on the physic material.

Angular drag might also need to be tweaked, but if you don’t (especially in a half pipe) have any, it might go absolute beserk after a few trips around the pipe

I had the exact same problem, and I’ve found a somewhat simple way of guaranteeing the required behavior. I know it’s an old post, but someone might get the same problem at some point.
I figured, that what I really needed was energy conservation, since my ball lost energy in each collision. So what I did was use that fact that height, mass and other physical variables were already given courtesy of the fantastic physics engine, and I calculated my ball’s total and potential energy at the start, and set the kinetic energy as required.
The following short script seems to guarantee energy conservation.

``````public class EnergyConservationMovement : MonoBehaviour {

public Transform cannon;
private float speed;
private float totalEnergy;
private float potentialEnergy;
private float kineticEnergy;
// Use this for initialization
void Start () {
speed = cannon.GetComponent<Cannon> ().velocity;
potentialEnergy = rigidbody.mass * 9.82f * transform.position.y;
kineticEnergy = 0.5f * rigidbody.mass * Mathf.Pow (speed, 2);
totalEnergy = potentialEnergy + kineticEnergy;
}

// Update is called once per frame
void Update () {
potentialEnergy = rigidbody.mass * 9.82f * transform.position.y;
kineticEnergy = totalEnergy - potentialEnergy;
speed = Mathf.Sqrt (kineticEnergy * 2 * rigidbody.mass);
rigidbody.velocity = rigidbody.velocity.normalized * speed;
}
}
``````

The cannon is the thing firing my ball, so just replace it with some other source of velocity or simply 0, if you want to start out with no speed.