- Home /
GameObject ignores collision while swinging from hinge joint 2D
I have an object with a rigidbody and a collider (the green square). When I click, a hinge joint is activated for this object, and it swings from where I clicked like a pendulum. However, when it is swinging, it ignores collision with the ground. When I release the mouse, and the hinge joint goes away, you can see the green box suddenly realizes "oops! That's ground!" and collides again. Here are some sample clips:
Any idea why this might be happening?
Have you solved this yet? I'm having the same problem :/
Exact same problem here, if I find a solution Ill post it ASAP
Answer by Necktron · Apr 10, 2017 at 02:43 PM
I think I found an solution! I've used transform.position when I move the character, try using rigidbody2D.position, you wont ignore collision then. Transform.position is basiclly "teleportation". Not sure if this is the most optimized solution, but it's good enough I guess
Answer by logicandchaos · Oct 03, 2018 at 02:09 PM
Yes you are not supposed to move objects with transform while using unity physics because that will break the physics, I am having a similar problem though, I have 2 objects one with a box collider and rigidbody2d and one with a circle collider, it's the arrow on a spinwheel and the pegs they collide no problem the arrow is fixed in place and rotates when a peg hits it, works, but then I want the arrow to spring back to place but when I add the hingejoint2d the 2 objects no longer collide.. not sure why.. EDIT: Lol, I solved my problem there is a tick box in hingejoint2d enable collision which is off by default..
Your answer
Follow this Question
Related Questions
Dealing with 2D movement and collisions! 1 Answer
Collider2D.IsTouchingLayers() delayed reaction 1 Answer
HingeJoint with no rotation? 0 Answers
Collider2D/RigidBody2D not working 1 Answer