AddTorque doesn't work 2D
I have some obstacle like stick that is upright. It's move by velocity vector in rigibody2d (-4,0). And I have a hero which always stay in center of game screen. When hero collides with a stick, I want that obstacle flew away with some rotation, depending on the point of collision (like the laws of physics, if the collision point near the edges, then more torque).
But, AddTorque on rigibody2D doesn't work, although AddForce works fine.
There is code of collision
![void OnCollisionEnter2D(Collision2D other)
{
if (other.collider.tag == "Block")
{
if (InvBonusEnabled) {
other.collider.isTrigger = true;
other.rigidbody.isKinematic = false;
other.rigidbody.AddTorque(100); //simple test doesn't work
other.rigidbody.AddForce(new Vector2(200, 50));
}
}
}`][1]
Your answer
Follow this Question
Related Questions
How to prevent a 2D Kinematic asset passing through a 2D Box Collider. 1 Answer
Stop movement on mouse interaction 1 Answer
Physics 2D with tile collider corner problem 2 Answers
Detecting Adjacent Provinces using Collision 1 Answer
Had to turn off gravity scale, but now player goes through walls 0 Answers