Diablo Style loot explosion

Hi, I have a Loot system that generates random loot and then instantiates it. After it has instantiated I would like it to move up and then away in a Diablo style fashion. I’ve tried a couple of things but get different problems with each, so I’m after some advice on the best way to implement. I tried to add force but I would rather not have a rigid body on the loot, and this was giving problems when multiple items were dropped simultaneously (items would collide and fly all over the place). I have looked at lerp, but am not quite sure how to use this in a random fashion.

Are there any other alternatives?

Maybe a foreach?

Foreach loot object,
Generate a goal vector inside unit sphere,
Construct a new vector to keep whatever axis you like (like maybe you want it to always move a certain distance on the y axis or something)

Interpolate the object from its spawn position to this new constructed position.

If you want them to fly up a little, and then back down to the ground, just first generate a vector to get the new X and Z position, and then find the halfway point between the start position and that new vector, then interpolate first to that vector + Vector.up *(howHigh) , before interpolating to the ground.

Actually in Diablo 1 and 2 the loot just spawned at it’s desired resting position and just did an up and downward motion in place. Things like chests simply spawned the loot items one after another.

However if you actually want to spawn it at the chest and move it outwards you can simply use a simple bezier curve. A quadratic curve would be enough, though a cubic may give you more control over the exit and landing normal. Keep in mind that diablo is a tile based game. When the loot is generated the game searches for an empty tile around the loot tile and just spawn the loot there. Also keep in mind that the whole motion can just be a visualization of the loot drop and not the actual loot flying around. Diablo 1 and 2 (never played d3). were 2d games. The whole 3d isometric look was pure well designed 2d sprites and clever layering.

That means when you want to drop loot around a certain point you would first find as many “drop points” on the ground where the loot should end up as you have items you want to drop. Then just iterate through all items you want to drop and move them along a bezier curve which should start at your chest / mob and ends at the corresponding drop point on the ground. This could be easily done inside a coroutine.

Though if you want a more realistical drop, using rigidbodies shouldn’t be that of an issue. In diablo gold always comes in “packs” / item stacks. I don’t think there was a loot chest or mob that dropped more than 20 items. Also since loot chests with many items take a while until all items are “dropped”, there are only a few items “in air” at the same time. Once an item has found it’s resting position you can simply remove the rigidbody.

In the end you are the developer. If you are the game designer as well you should know how you want it to look like. If you use another game as inspiration, just look carefully how it behaves.