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"

How can I continuously find how many collisions happened in the last 2 seconds?

Hi, I currently have a system set up in my Level Blueprint to count how many times all instances of a class blueprint (Sphere) have collided with the walls in the level. That system loos like this:

alt text

The counter is triggered by the "Hit Event" in the class blueprint using an event dispatcher.

This works as I want it to. However, I want to use the variable generated by this to continuously update a float parameter within a Sound Cue. Which again is fine, with this system:

alt text

My problem is, I don't just want the parameter to go up in a linear scale i.e. the more collisions there are the higher the parameter goes. I need it to be continuously monitored, as in constantly updated with how many collisions there were in the last few seconds, so that the parameter can change in real time along with the amount of activity within the level.

But I'm completely stuck! Any advice would be greatly appreciated.

Thanks in advance.

Product Version: UE 4.8
Tags:
more ▼

asked Jan 04 '16 at 02:25 PM in Blueprint Scripting

avatar image

ThatJoeThom
77 25 24 29

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

The easy way would be to connect a 2s delay node to your set node and just decrease the value by 1 again.

more ▼

answered Jan 04 '16 at 02:28 PM

avatar image

TTaM
1.7k 79 28 81

avatar image ThatJoeThom Jan 04 '16 at 02:58 PM

HI, thanks a lot for your response but I'm not sure how this would work. Surely that would just reduce the collision count by 1 every two seconds. What I need need is something that may work in a similar way to a Tick, but every time the tick fires it looks back two seconds from that particular frame and updates the amount of collisions that happened in the two seconds prior to the frame, thus giving a value that is updated on an ongoing frame by frame basis.

I know it's not possible to do it that way but just trying to find a workaround that will do something similar!

Thanks again.

avatar image TTaM Jan 04 '16 at 03:31 PM

A delay node simply delays execution of the next node by 2 seconds. It does not repeat, unless you call it more than once.

event -> add 1 -> delay 2s -> remove 1

That is what it does.

I notice your set node execution goes off to another node. You'll want to put the 2s delay at the end of that chain of nodes.

avatar image TTaM Jan 04 '16 at 03:33 PM

The alternate, and far more complicated, method would be to have an array of times when the event occurred plus (2 seconds.) Sort of like a queue of times. When your event occurs, you queue up the current time plus 2 seconds. On tick, you dequeue the number of times which are less than the current time. The number of events in the last 2 seconds is the size of the queue.

(comments are locked)
10|2000 characters needed characters left
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