playMaker

Author Topic: Apply force on all objects. [SOLVED]  (Read 891 times)

Doh

  • Full Member
  • ***
  • Posts: 124
Apply force on all objects. [SOLVED]
« on: November 29, 2018, 09:32:27 AM »
Hey, I've been setting up some conveyor belt systems over the last couple of days.

I've managed to do it through having the conveyor object send an event to the objects that land on it. Though this method means having every object that has the potential to land on a conveyor have its own FSM just to handle the forces applied to it.

Is there a more simple way to do this?

Ideally I'd like the conveyor to handle everything and just recognize all objects (of a certain layer) within its trigger volume and apply the force to each object itself. This is simple enough with just one object, but I can't see how I'd do it to varying quantities of objects. If there is a way to apply force or set velocity on every object in an array in one state I'd be sorted.
« Last Edit: November 29, 2018, 11:27:24 AM by Doh »

Doh

  • Full Member
  • ***
  • Posts: 124
Re: Apply force on all objects.
« Reply #1 on: November 29, 2018, 10:48:42 AM »
As usually happens in life, after I explain a problem, a solution comes to mind.

I've cut it down to 2 FSMs on the conveyor, one detects trigger events then adds/removes them from an array on the second FSM, the second FSM then loops through the array applying a velocity to each one, when it reaches the end of the array it does a next frame event and starts over.

This seems to work well at the moment, it's also shone a light on some of my misconceptions as to how much can occur in one frame.