Can't Add Force to multiple objects in array?

Hi all,

I am still rather new to blueprint and so if there is a better way to approach this please let me know. My current problem is that it doesn’t seem possible to add force to multiple objects at once. For visual example, imagine, you point at a box. That box has friends. If you pick it up you apply the same force to all of its friends and so they all rise or fall together.

A blueprint can only have one event tick, Event tick can only have one output stream and apply force doesn’t accept more than one target at a time (Definitely not an array). To daisy chain 20 add forces seems like a really bad idea.

I tried to work around this by having a two step sequence triggered by an event input (Click) that first traces a line to an object. It retrieves an array from that object and in a loop casts each object in the array to the correct class, gets the target and attempts to add force to each object within that array by piping that target to the input of an add force in step two of the sequence. I’ve printed the array retrieved by step one and the returned list of targets is correct. Unfortunately, only the first object is getting force, the rest are ignored.

How can I add force to more than one object at a time?

https://i.imgur.com/Sn3qP6P.jpg

It’s not set up correctly. You need to Loop during Tick; otherwise you’re applying force to the last element in the array only. This is also pretty unsafe and likely to crash hard eventually.

Pseudo script below:

Definitely create an array variable and only then have Tick loop through that. Much safer.

  • create an array of Blocks (Static Mesh Component type, I presume) variable
  • onTouch, clear that array
  • loop through the stuff as you do but add the Blocks to the array
  • once the above loop is Completed, only then open the Gate (once is enough, you’re opening it multiple times)
  • have the tick loop through the array

Thanks!

Took a few tries to get this wired up correctly. If tick flows through the beginning of the network I had built it reset the mouse position every tick thus settling the length of my then dragged vector to 0 and subsequently force applied is 0.

Adding a sequence just before the gate to first set the mouse position THEN open the gate got this working.