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"

Can I enter door with trace and close automatically with collision?

I have a door system that works with tracing. However, when I try to close automatically by exiting collision I can't get it right. What might be wrong? The photos show the code before anything is done with the overlap event. I connected it everywhere with bad results.

Product Version: UE 4.20
Tags:
more ▼

asked Dec 10 '18 at 12:50 AM in Blueprint Scripting

avatar image

NtinosFerret
17 2 2 4

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

1 answer: sort voted first

As for me, you're overthinking it a bit.

1. Why do you need trace that runs off tick for that? You can launch a trace once when you press E. You'll have to do that in the Character BP though.

2. I don't know what the curve in your timeline is, but I think you're using it wrong. Adding the curve value to the current rotation will give you different results depending on the frame rate. You have to either use Ease or Lerp with the Timeline curve as Alpha, or make the curve go from the rotation value when the door is closed to the rotation value when the door is open, but ceratinly not adding.

3. When you reverse the Timeline, you still Add the rotation angle. How do you want to close the door, if you keep opening it even further? But if you follow the suggestion in p.2, that won't be a problem anymore.

more ▼

answered Dec 10 '18 at 07:06 AM

avatar image

Tuerer
1.8k 12 7 8

avatar image NtinosFerret Dec 11 '18 at 11:48 AM

Thank you for your reply! I run tick because I want the player (First Person) to be able to locate different cabinets and doors that are next or close to each other, and I want the interaction happening when the player is looking at the door and not just when they are in a trigger and may be looking away but the doors still work.

The curve is working fine until I mess with overlap. I also tried a different (opposite values) one but the results were bad. Any further help will be appreciated, I'm actually a modeler but I got pretty good at handling blueprints in the last months, by using tutorials of course. Thanks again!

avatar image Tuerer Dec 11 '18 at 12:21 PM
  1. That's exactly what I'm talking about. If you want to open the door only when you're looking at it, then a one-time trace on E press would be the perfect solution. You send a forward line trace, and see what it hits. If it hits the door, you send the Open Door command to that very door. No need to use any trigger boxes at all.

  2. Make two Rotator variables: the door rotation when it's closed and when it's open. Create a Timeline with a curve that lineary goes from 0 to 1 in 1 second. Create an Ease node, and feed the Timeline curve pin in into Alpha of the Ease node. Connect Closed Door Rotation to A, Open Door Rotation to B, and the result — to the Set Actor (Component) Rotation of the door.

  3. Make two functions like Open Door and Close Door, connect them to the Timeline's Play and Reverse (for a better way, create respective interfaces so that you wouldn't need to Cast to the Door BP), and when you press E and the trace hits the door, call the Open function of that door, and when you leave the trigger box, call the Close function.

    I hope it's clear from the text, I can't show you any screenshots now.

(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