x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Physics Constraint Issue

So I have been trying to make a door that sits on a hinge that I can kind of walk into to open. I want it to move freely so I looked into the physics constraints tool. I set the constraints to hinge and used the presets that where set in the details panel for the hinge setting. However when I press play to test it, the door is set five feet behind the hinge and sticking into the ground. I can only assume that I need to get the doors location in a blueprint somewhere, but I want to be sure before I start that. Can anybody tell me if I did something wrong?

Note: the door is set to simulate physics

Product Version: Not Selected
Tags:
more ▼

asked Nov 13 '14 at 07:41 PM in Using UE4

avatar image

XLCRHItmanEQ
31 4 8 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi XLCRHItmanEQ,

I would suggest creating the entire door inside of a blueprint. I used the SM_Doorframe and the SM_Door from the starter content.

  • Create an actor class blueprint.

  • In the Components tab, add the Doorframe as the root and the Door as a StaticMesh component under that. If you use the same assets I mentioned above you will need to move the door into place.

  • Add a PhysicsConstraint and place it midway up the door and where the hinge should be located.

  • In the PhysicsConstraint Details panel, add the door frame as Component 1 and the door as Component 2.

  • Adjust your setting to how I have pictured below. This will limit the movement.

alt text

The rotation is relative to the blueprint so you can place this any direction and duplicate it as many times as needed and it will always swing correctly.

If you have any questions, please feel free to ask.

Cheers,

TJ

ah_swingingdoor.jpg (116.1 kB)
more ▼

answered Nov 14 '14 at 08:03 PM

avatar image

TJ V ♦♦ STAFF
41.1k 1009 183 493

avatar image XLCRHItmanEQ Nov 24 '14 at 11:25 PM

thanks tj I was trying to make the door rotate on a pair of hinges instead of the frame, the frame idea works better. Thanks again

avatar image XLCRHItmanEQ Nov 25 '14 at 11:01 PM

actually I am having trouble finding where to find where to add the components at.

avatar image TJ V ♦♦ STAFF Nov 26 '14 at 02:22 PM

Sure, once you create your blueprint, click the 'Components' tab (highlighted below in orange).

alt text

  • On the left, in the 'Components' panel, click the 'Add Component' dropdown and add 2 'Static Mesh' components.

  • I set the Frame as the root component since it will be stationary (you can still move the blueprint around the level, it just won't be swinging dynamically).

  • Set the Door as the 2nd component with 'Simulate Physics' enabled.

  • Use the 'Add Component' dropdown again and add a 'Physics Constraint'.

  • Then set the 'Physics Constraint' setting to what I have pictured in my first post.

If I'm misunderstanding exactly what your asking, please post back and we can go into further detail.

Cheers,

TJ

avatar image Crowley Caine Oct 31 '15 at 09:32 AM

Hi,

Used this method to make doors and it works perfectly, really good job. Question though, how can I make the door return to it's natural state (closed/no rotation)? The way it works now is that when I run through it, it opens just fine and it then swings shut. However it doesn't stop swinging and will also swing open the other way again. I can't add a doorjamb because that would lock me inside my buildings. Any ideas?

avatar image TJ V ♦♦ STAFF Nov 04 '15 at 08:51 PM

Hi Crowley,

To adjust the physics swing as if the door is hitting a door jamb, you can adjust the Angular Rotation Offset. In this example I have a door that can swing 45° but I needed to offset the physics constraint so it would swing correctly, so I adjusted the Angular Rotation Offset by 45°.

alt text

As for the door stopping once it is 'closed', you could do something like the door is not simulating physics when it's closed. For example: The player clicks the door and it simulates physics and opens the door a little (slight impulse) > If the door ever reaches the closed state (just a predetermined rotation value), the physics simulation on the door will be disabled again.

You could of course just forgo physics completely and just animated the door with blueprints to move between an open and closed state when the player interacts with it.

I hope that helps a bit. Let me know if you have any questions.

physicsdoor01.png (306.0 kB)
avatar image Crowley Caine Nov 04 '15 at 09:13 PM

Well I was just looking for a way to make it somewhat automated without a specific trigger point, ie the door opens or closes based on the body for the player character, but also closes if the player character is not interacting with it. I would dearly like to avoid any clicking at all because I kind of hate that when it comes to environmental interaction. I suppose a small doorjamb would work in a sense, because the "push" of the player character would defeat the physics of the doorjamb once significant force is applied, but it would still be somewhat choppy and prone to bugs.

avatar image TJ V ♦♦ STAFF Nov 04 '15 at 09:19 PM

The other option would be to use an Angular Motor so the door always tries to push itself closed when something is not interacting with it. Just a heads up, Linear and Angular Motors sometimes take some trial and error to get them working the way you want.

avatar image Crowley Caine Nov 04 '15 at 09:34 PM

That sounds promising :) Thank you so much for your input!

avatar image Crowley Caine Nov 04 '15 at 09:44 PM

Ok sligth update, since your comment I set angular position strength and angular velocity strength to 20 - PERFECT results in my particular instance. A door on a doorframe with no hinge, only a physics constraint working as the hinge. The results are amazing, exactly what I was looking for!!

avatar image TJ V ♦♦ STAFF Nov 05 '15 at 12:58 PM

Nice, I'm glad it worked out! :)

Good luck with the rest of your project.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question