0
\$\begingroup\$

I just finished modeling a scene in Blender like this:

enter image description here

Now I'm animating and creating interactions between the player and the objects inside the house. When I reached the doors, I started having doubts.

Originally, I created the doors animations using Blend Shapes to easly control the transition between the open/close states and to allow the door being half opened or closed. (That's because my interaction system allows to interact partially with object, like for example the door system at Amnesia The Dark descent / outlast)

enter image description here

The trouble is, that the collider of the doors doesn't update when the Blendshapes values changes.

How can the player open this door and have its collision physics stay in sync

\$\endgroup\$
2
  • \$\begingroup\$ I found this solution, someone with Unity proficiency could check it and make a proper answer out of it: answers.unity.com/questions/1547927/… \$\endgroup\$ – Markus von Broady Dec 19 '20 at 14:42
  • \$\begingroup\$ I tried it, but it has performance impact and on build throws random errors. \$\endgroup\$ – Haytam95 Jan 4 at 20:00
0
\$\begingroup\$

I'd recommend chopping out your doors and exporting them as separate objects, with the pivot in a sensible place like along the axis of the hinge.

In Unity, give the door a box collider and kinematic RigidBody, along with a script to control its opening and closing according to the player's input. You can make a prefab of this so you only need to do this setup once for each kind of door.

Position each door instance inside its door frame within the scene editor.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you, just for clarification: That control script (along with the input logic and so on) should just modify the door Local Rotation. Is that right? And one more: If the door is a kinematic rigidbody, that means it would push the player? \$\endgroup\$ – Haytam95 Dec 9 '20 at 14:33
  • \$\begingroup\$ That's one option, though I'd recommend using Rigidbody.MoveRotation to keep the physics engine happy. If the player has a dynamic rigidbody, then they can be pushed by the door. If they're kinematic or using a character controller, you can choose to have them not pushed by the door, or resolve the collision in other ways according to your needs. \$\endgroup\$ – DMGregory Dec 9 '20 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.