HingeJoint2d - find connected anchor
I have two object, that can be connected together by HingeJoint2d, I am creating joint by code in c#:
Now when creating joint, I need to specify anchor points, anchor will be always bottom center of the blue object A
However I am unable to calculate connected anchor, my goal is to place connected anchor in exactly the same position as anchor (like on the picture, where red dot it)
Is there possibility to calculate it? Blue box can be connected anywhere (i want to use it as a crane to lift green object)
Thank you.
Answer by hexagonius · Sep 14, 2015 at 05:41 PM
Yes there is, by transferring the information of position over to the green box:
Vector3 BlueBoxLocalPositionInWorldPosition = bluebox.TransformPoint(Vector3.down * .5f);
Vector3 worldPositionInGreenBoxLocalPosition = greenBox.InverseTransformPoint(worldPositionOfBlueBox);
Your answer
Follow this Question
Related Questions
Player Movement Not Always Responding 1 Answer
Help achieving a pogo stick like shock absorbing leg 0 Answers
Collider fires consistently, but Trigger does not? 0 Answers
Physics2D, impersonate old RigidBody2D "Freeze Position" How? 1 Answer
Configurable joint don't rotate around the local axis of the rigidbody 0 Answers