Hi, I’m trying to get multiple instances of an object (logs floating down a river) to drift at different speeds.
Then when they get outside the screen (x position of log < -75) I send them back to the start at random points within a range. This part works fine.
But getting them to drift at different speeds doesn’t work. I’ve given them random in range speeds, the range wouldn’t really be that big, just made big for testing. But each log travels at the same speed and it seems to travel at the lowest speed in the range only. This screenshot shows me doing the instant force in a repeat for each instance event. But I also tried it without the for each instant part. Neither work, the logs all travel at the same slow speed.
What am I missing? The logs don’t have any behaviors or effects and there are no other events so far.
I believe what is happening is that in the “Repeat for each instance” it is picking a random number, but the same one gets applied to all logs, not just one at a time. The same happens for where it has no condition. Have you tried something like a “trigger once” for setting the randominrange into a var, and then next event applying that to the log object as the speed force, so that it cycles through a new random number for each log object?
If I had to guess, I’d say that it’s because you’re assigning a new force value on each frame. It’s happening so often that the random numbers might be kind of cancelling or averaging out and they all look the same. I’m not at my PC to test.
I would suggest a one-time random intial permanent force. You could always add a little occasional small positive or negative force to add a little variability. But that depends on your intentions.
You might need to stop the force and reapply a new force after each pass thru.
Snowbunni I had a go with your idea but no success.
Keith, that was good advice about using permanent forces, the results are more consistent. I tried doing what you said of using a simple random and it worked for a positive number but no movement at all for a negative number. Curious, I explored further and this is the result with all events using permanent force applied once.
works means logs move at different speed
doesn’t work means logs move at same speed
Event 1 is random in range with positive numbers. It works.
Event 2 is the same (original) random in range with negative numbers. It doesn’t work.
Event 3 is using a different force action to get the logs to go from right to left with no negative numbers in random in range. It works.