- Home /
Question by
Gobius · Mar 08 at 01:41 PM ·
2dcollision2dbouncereflect
2D Reflect(bounce) With Rotation
Hello,
I am new in Unity. I want to bounce a stick.Stick jumps but rotation is ignored. How can reflect (bounce) using rotation?
private void OnCollisionEnter2D(Collision2D collision)
{
Vector2 ground = collision.contacts[0].normal;
var dir = Vector2.Reflect(rb.velocity.normalized, ground).normalized;
rb.velocity = dir.normalized * speed
}
[1]: /storage/temp/193619-img.png
img.png
(14.2 kB)
Comment
Your answer
