Question by
normoustgstaff · Feb 06, 2019 at 12:48 PM ·
rigidbodyunity 2dkinematic
Push back kinematic object
Hi, I'm trying to push back an Kinematic object.
Somethink like
Vector2 push = new Vector2((other.position.x - transform.position.x),
0).normalized;
push *= 500f;
Rigidbody2D pushRB = other.gameObject.GetComponent<Rigidbody2D>();
pushRB.velocity = Vector2.zero;
pushRB.AddForce(push);
(This code inside OnTriggerEnter2D)
For Dynamic bodies. I have tried to use velocity but the objects starts moving constantly, so its not working for me.
Any suggestions ?
Comment
Hello
Did you debugged the code?
Is pushRB.AddForce(push) beeing appied only one frame or more frames?
You can always move it with Translate() but will lose reality effect.
Your answer
