# Physics Based Door With Closing Mechanism (5.0)

**URL:** <https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396>\
**Category:** Character & Animation\
**Tags:** unreal-engine, UE4-27, question\
**Created:** [February 7, 2022, 6:35pm UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396 "2022-02-07T18:35:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobery](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nobery](https://forums.unrealengine.com/u/nobery)\
**Post date:** [February 7, 2022, 6:35pm UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/1 "2022-02-07T18:35:21Z")

</div>

How should I go about creating a dynamic / physics based interactive door (Physics Constraints?) that also animates a self-closing mechanism relative to the doors open angle?

 ![door-test](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/8/668546c656b002eaf3e372c57c4256f3781feb4b.png)

Questions:

1. How would you try and implement this? My first thought was Physics Constraint on the door, then a separate mechanism with a 90 frame sequence that I could play relative to the 90deg angle of the physics constraint based door? But I feel like there must be one smart way to keep this fully physics based?

2. Am I right in thinking that I can’t export the IK chain from 3D Studio Max but instead have to create this functionality specifically within UE (2 bone IK)? The IK chain I have in Max currently works perfectly, would be nice to be able to just import this…

3. Should the door, door frame and mechanism all be one single mesh? Currently I have them all separate. How would you manage the assets?

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [February 7, 2022, 7:18pm UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/2 "2022-02-07T19:18:00Z")

</div>

In general, just don’t use physics. Its too unreliable. And a PITA…

> [@nobery](#):
>
> How would you try and implement this?

A slerp or motor on the constraint could just push back the door.  
The motor would have to be tuned to where it won’t push back objects. But when there isn’t anything it between it would return in position.

> [@nobery](#):
>
> Am I right in thinking that I can’t export the IK chain from 3D Studio Max

No. A door is _solid_ there’s no need for solid or mechanical objects that won’t bend to waste the resources needed with a skeletal mesh.  
Ever.  
There’s engine components to do exactly what you need without having to use skeletal meshes.

Using skeletal also generates a slur of Light issues

> [@nobery](#):
>
> Should the door, door frame and mechanism all be one single mesh?

Separate is best. Up to a point.  
You wouldn’t need to separate the door knob, for instance. Or the lock mechanism if you had one.

Anything that moves individually needs to be separate.  
Door frame. 2 arms. Door. Possibly locking bolt.

Then you just build out the hierarchy into the BP by parenting the door to the frame, and the 2 arms to the respective frame and door counterparts.  
Couple of constraints, and they should automatically react dynamically…

---

<div class="post-metadata">

**Author:** ![nobery](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nobery](https://forums.unrealengine.com/u/nobery)\
**Post date:** [February 7, 2022, 7:47pm UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/3 "2022-02-07T19:47:49Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [February 8, 2022, 6:42pm UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/4 "2022-02-08T18:42:48Z")

</div>

Wanted to share an example of WHY physics are always a bad idea: (video is unusually bright, but decent enough to illustrate the issues at hand).

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/0/370f8105c4637ec872d0bf79364febbfb6d6defa.jpeg "UE4 Door Physics Sample") ](https://www.youtube.com/watch?v=uTqX0Ak_69I)

Doing the same exact thing with a BP driven LookAt node would by nature prevent any and all sorts of glitches and stuttering.

---

<div class="post-metadata">

**Author:** ![nobery](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nobery](https://forums.unrealengine.com/u/nobery)\
**Post date:** [February 9, 2022, 8:32am UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/5 "2022-02-09T08:32:27Z")

</div>

Thank you! That’s extremely helpful.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [February 12, 2022, 9:32am UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/6 "2022-02-12T09:32:12Z")

</div>

As I was re-redoing this properly, I figure I’d share some intel for the next sucker, so they wont have to start from Meccano like pieces to realize the math.

First of. Simplify the ever living s\*it out of it.  
2 sticks.  
They meet up “somwhwre”.  
One is tied to the door. One is tied to the frame.

Second of. The sticks are of a fixed lenght.

This in fact leads to 3:  
Each stick is the radius of a circle.

Which leads to 4:  
The “somewhere” up there, is actually the “intersection” of 2 circles.

As a result, you write an overly complicated mathematical blueprint noodle thing, where you take only the X / Y of both origins and the 2 radius into account.  
Within it, you play will play around with the Radius,  
And the ever old fact that the sum of the area of 2 squares built on the Rec-t-riangle is equal to the area of the square built on the hypotenuse. Ya know whater the engine veraion of a Phytagorean theorem goes.  
If this is Greek to you, theres a good reason. Look it up.

AFTER some noodle puke, you then get an X and Y coordinates to combine with a standard Z.

Given this point, you literally “find look at rotation” from the beginning of the stick to the point you found, and apply said rotation to the stick(s).

Takes you about an hour.  
Solves instabilityy and most importantly, never stutters or breaks. Unless the door does…

---

<div class="post-metadata">

**Author:** ![nobery](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nobery](https://forums.unrealengine.com/u/nobery)\
**Post date:** [February 12, 2022, 1:10pm UTC](https://forums.unrealengine.com/t/physics-based-door-with-closing-mechanism-5-0/495396/7 "2022-02-12T13:10:50Z")

</div>

Thank you a lot, very informative!
