Hey there,
I have currently the problem, that I’m launching an Object, which shall rotate in the direction it is flying based on the velocity of the object.
So far, everything works fine, except that, if the object collides with the ground, it stats jumping / rotating like wild.
If I remove the script part, which rotates the object in flight, it bounces of the ground like I want.
here is the code part for the rotation:
if (!isCollided)
{
float heading = Mathf.Atan2(rb.velocity.y, rb.velocity.x) * Mathf.Rad2Deg;
projectile.rotation = Quaternion.Euler(0, 0, heading);
}
The “isCollided” attribute is set to true on the first occuring collision with the ground and will never change afterwards.
If i comment that out of the code, everything works fine. I think, the rotation messes up the RigidBody2D Material, which creates the bounce effect, but I don’t know, how to solve this ![]()