Guys , I’m really having a hard time with unity’s physics when it comes to precision…
I have this pool game I’m doing … when collisions are fast, it’s all good balls react as pool balls , they always collide and go their separate ways … at really low speeds balls roll against each other in a weird way , like one is pushing the other… not really as it should happen in reality … same thing happened to me with wall collision … at lower speeds instead of a ricochet , balls would roll like they we’re glued to the walls … instead of bouncing off the wall like they should…
I did correct that problem with walls myself … with:
if(other.gameObject.layer==10){
for (var contact : ContactPoint in other.contacts) {
rigidbody.velocity=Vector3.Reflect(-other.relativeVelocity*0.804,contact.normal);
}
}
because since the wall never moves , relativeVelocity always corresponds to the velocity of the ball when it entered the collision …
Now for balls , I cant do this … because relativeVelocity is not what I want , I want the speed of the ball EXACTLY before collision , and OnCollisionEnter sometimes gives me the speed before ball changed route, sometimes after ball already changed route , so I cant set new direction myself…
Im getting crazy with this …
Can anyone please help me ?