# MATH QUESTION: How can I calculate the space an actor occupies?

Hello everyone!

I have a floor of size 80cm x 50cm and over it I have a CollisionBox(Disabled collision) to use it as Spawning Area by using RandomPointInBoundingBox Node in my blueprint script I have some functions that spawn different sized actors all over the Spawning Area randomly. I wanted to know how can I calculate the size of each spawned actor occupies so when I would generate a random location to spawn another actor in the Spawning Area avoid the space other actors occupies in the Spawning Area and spawn other actors without colliding with all the other ones that are there.

This is an interesting question.

First, you have to get the size of the actor. For that, you can get the actor bounds. This will give you a rectangular shape that the actor occupies.
After that, you have to do some math to figure out where to fit the actor if you already have other actors placed.
For this, you need packing algorithm.

Here’s the documentation and an implementation:

http://blackpawn.com/texts/lightmaps/default.html

Ooor, you could just place your actors in the same place and check an option on the actor (can’t remember how it’s called) to place it even if it overlaps other actors. This would would have to be changed later on, as the actors will probably be projected all over the place.