- Home /
Code-moving objects dont affect Physics2D objects
Hello, I am having an issue with Physics and I am not really sure how to solve that.
What I have:
Object A: - I have a moving object A (square sprite) with a 2D collider and a rigidbody (kinematic) on it. - The object gets move by code with dotween ( transform.DoMove((x,y,z), 1.0f) ) - The objects moves on the X-axis (from left to right and then from right to left => looping)
Object B: - I have a circle sprite with a circular collider 2D and a rigidbody (dynamic) on it. - The circle gets moved by physics2d (addForce(x,y)) - The circle moves my physics on the y axis (it could also be moved on y and x but to keep it simple lets just say it moves only on the y axis from bottom to top)
My Problem now is, that the moving object A does not affect object B correctly. It just pushes B ways but does not add any force to B. Perfectly seen when you place B without any movement directly on the animation lane of A and once it hits B it just gets pushed out of way but it does not start sliding away (like a real push would do). I've understood where the problem is because A does not have any physics velocity and setting it (with m_rigA.velocity = new Vector2 (1,1); )does not change anything I guess because it is set to kinematic and not dynamic...
How would be the best was to set up a code moving barrage that affects the physics of colliding objects. Thanks for your help and best regards, Luke
Your answer
Follow this Question
Related Questions
How to accurately detect collision? 2 Answers
Moving object to another object 0 Answers
Get a mouse object click 1 Answer
Physics2D.Linecast and Physics2D.Raycast don't seem to return null 1 Answer