Trouble with Parenting gameObjects and BoxColliders
Hello
For the game I am currently working on there is a mechanic where a player can pickup a box in front of them and it will float in front of them like pictured. However, I am having trouble getting the BoxCollider to work properly.
Since the Box being picked up is parented to the empty gameObject BoxHolder seen in the heirarchy, its collider won't work properly when parented. To get around this, whenever the player picks up the box, the box's BoxCollider is destroyed and a BoxCollider is added to BoxHolder. This works, however as you can see the collider isn't exactly the right shape/size. Does anybody know of a good way to fix this?
Can you explain the setup a little more? why is the player a child of another gameobject? is player container scaled?
my guess is, the container is scaled in one axis which means you need to divide the colliders values each by the scale values.
But overall it's very bad to scale at all. if you need that only for the player collider and visual, make the visual itself a separate child and scale it. adjust the collider height on the now empty gameobject as needed.
Answer by Veerababu.g · Jan 30, 2016 at 08:37 AM
whenever it is collieding set the position of the child where you want
Your answer
Follow this Question
Related Questions
How to set GameObject created by MenuItem as a child of Canvas 0 Answers
All rigidbodies fall through terrain 1 Answer
http://answers.unity3d.com/questions/8472/help-with-error-expression-denotes-a-type-where-a.html 1 Answer
Moving grabbed object OnTriggerStay2D 0 Answers
My collider2D don't work 1 Answer