bouncy between two objects with velocity
Hello,
I'm learning Unity so i'm trying to make a game like "King of Opera". There are X players who have to push each other out of the ring but with a knockback.
I don't know how to do them pushing each other. I tried the Physic Material "bouncy" on both objects to have the push during collision but it doesn't work.
So, I use the velocity (with the variable "velo" that I increment to increment speed when the player use the key "space") of the object to move it. Maybe I have to use Force ? Is it different ?
GetComponent<Rigidbody2D>().velocity = forward * Time.deltaTime * velo;
I think it could be great to add the vector of the object to the other like that:
void OnCollisionEnter2D(Collision2D coll)
{
coll.gameObject.GetComponent<Rigidbody2D>().velocity += GetComponent<Rigidbody2D>().velocity;
}
But that doesn't work, do you have an idea ? I tried to change the mass of my object but nothing changed...
I'm just trying to do that :.
Thanks in advance for helping.
Your answer
Follow this Question
Related Questions
collision.relativeVelocity always zero 1 Answer
Bounce not working when Velocity is below 1f , what could it be? 0 Answers
Rocket Landing 1 Answer
Why is my momentum not carrying over to the X axis? 0 Answers
How to keep a bounce solid 0 Answers