# Pysics not working as expected

Hello all,

I have a scene that looks like this: (Image below)

A Ball that falls down and a blue rectangle. The blue rectangle is atached to a parent object (red dot) this red to is rotated slightly with a Button press and therfore moves the blue rectangle up and down. Video that shows the scene in action

My Problem is that even though i have a rigidbody2D on the ball and colliders on both objects the ball is not been bounced away when the blue rectangle is moved up. The ball gets only moved up as high as the blue rectangle and doesnt keep its velocity. Ball keeps “sticking” to the rectangle

But what i would like to happen is that the ball gets bounced away depending on when the blue rectangle is moved up and where on the rectangle the ball is at that time:

My code look like this and runs in fixedupdate:

``````if (kicking)  //If anykey is pressed move blue rectangle up by rotating parent to +15 degrees
{

float zVelocity = 0.0F;
float zAngle = Mathf.SmoothDampAngle(rotator.eulerAngles.z, KickAngle.z, ref zVelocity, 0.035f);
rotator.eulerAngles = new Vector3(rotator.eulerAngles.x, rotator.eulerAngles.y, zAngle);
}
else //If no key is pressed move blue rectangle down by rotating parent to -10 degrees
{
float zVelocity = 0.0F;
float zAngle = Mathf.SmoothDampAngle(rotator.eulerAngles.z, DefaultAngle.z, ref zVelocity, 0.035f);
rotator.eulerAngles = new Vector3(rotator.eulerAngles.x, rotator.eulerAngles.y, zAngle);
}
``````

If you have any idea on how to achieve this or even just a keyword or topic which could help me that would be highly appreciated. Thank you in advanced

The best whishes from Switzerland
snow2405

Any object with a collider that is supposed to be moved or rotated has to have a rigidbody / rigidbody2d component attached. Never (ever) move or rotate a static collider without a rigidbody(2d). For rigidbodies which should not be controlled through physics but through script you make it a kinematic rigidbody.