- Home /
Collider2D and Translate problem
Hello, it's almost the same problem HERE. I am trying to bounce the tile above the circle on top of the platform, there is no problem when the platform is fixed, but when the script who make the platform move is activated, the tile crash the circle, as in this picture:
and this is the inspector of the 3 GameObjects:
and this is the script for moving the platform:
public float min;
public float max;
public float speed;
public float sens;
void Start(){
sens *= speed;
}
void Update () {
if (transform.localPosition.x > max) {
sens = -speed;
} else if (transform.localPosition.x < min){
sens = speed;
}
transform.Translate (sens * Time.deltaTime, 0, 0);
}
i have no idea what is the problem.
can anyone help me please
Answer by hatem91 · Jul 19, 2015 at 04:06 PM
I find the problem, i have to add a kinematic Rigidbody2D to the moving colliders. Colliders without a rigidbody are treated as static colliders by Unity and should never be moved.
Your answer
![](https://koobas.hobune.stream/wayback/20220611231843im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Detect onMouseDown() on children colliders of a rigidbody parent 2 Answers
Collision detection for 2D topdown game 2 Answers
Workarounds for Higher Control When Using Physics2D? 0 Answers
How to Maintain Constant Velocity of a Moving GameObject? 0 Answers
(2D) Can't use colliders when I have a kinematic rigidbody? 1 Answer