- Home /
Problem With Kinematic Children
hello, so i have my player who can walk up t crates and on the press of a button the crate becomes its child (to simulate backwards dragging). on the release of the button the crate loses its parent attachment. now i am doing this by setting the child's rigid body as kinematic and disabling kinematic. the only problem with this is that since its kinematic it goes through walls and stuff. it's not a fun-killer but it looks ugly and breaks the feel of the game. how can i go around this? can i drag crates any other way than parenting it and setting it as kinematic? now keep in mind that its a 3d game, the crate needs a rigid body because of the way it has to behave when not being dragged etc. oh and yes, everything has colliders, (mostly box colliders).
Answer by JedBeryll · May 25, 2016 at 04:46 AM
You can try joints. Fixed joint for example. That way you can keep it non-kinematic and no need for parenting. Give a joint to the player (or its hand or however you want it) and assign the crate's rigidbody to the joint's connectedBody.
okay, that makes sense! now i'm gunna show a little noobness but whatever. i added a fixed joint to my player character (who also happens to be a rigid body) and he didn't move unless he had a connected body set, now that;s not ideal since the player has to walk up to the crate and press a button. am i missing something? or is this method not ideal since my player character is also a rigid body???
One way would be to set the fixed joint's connectedAnchor on its own position in Update or FixedUpdate. (yeah sounds pretty unprofessional). Other is to add the fixed joint to the crate (it works as long as you don't want it to move any other way).
thank you Jed, really appreciate your help! i was forced to change the way i handle crate movement so this no longer presents an issue, either way thank you!
Your answer
Follow this Question
Related Questions
Guidelines for using rigidbody, collider, CharacterControllerScript, etc? 3 Answers
How can i Prevent Kinematic object not to pass through another rigidbody object 1 Answer
Simple Movement Game: Physics vs Manual Collision Detection? 2 Answers
Disable ragdoll without changing Kinematic boolean? 2 Answers