- Home /
Block Game Object interaction with another Game Object with kinematic active
Hello,
I have objects on screen which i move with Input.acceleration;
I have inside Update()
GameObject1.transform.Translate(moveDirection.x, 0, 0);
GameObject2.transform.Translate( 0, moveDirection.y);
They do contain BoxCollider2D with Rigidbody2D. (trigger is disabled) I also allow: "useFullKinematicContacts" to allow collisions.
All i want that each GameObject won't be able to pass through the other GameObject
I did manage to prevent the GameObjects going through each other, by forcing them to move to the opposite direction, but this action can generate like a shake movement if player try to force collision. All i am asking is how to prevent this Shake effect and make smooth blocking between the GameObjects
private void OnCollisionStay2D(Collision2D coll)
{
GameObject1.transform.Translate(moveDirection.x*-1, 0, 0);
GameObject2.transform.Translate( 0, moveDirection.y *-1);
}
Thank you
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
DIsabling a Box Collider Trigger after cut scene 2 Answers
Distribute terrain in zones 3 Answers
How to make my object bounce off the screen bounds? 1 Answer
Problem with 2D Collider Trigger 1 Answer