I am trying to accomplish an effect where a player can grab physics objects and set them on a table. When these objects hit the table, they will float and organize themselves on the table.
I am not sure how to do this. I think I have two options:
- I can use a component hit to detect when the object hits the table. I then can get an array of all the other objects hitting the table (I think) and use their positions to guide the new object into the right position.
- I can put a bunch of sockets in my table model and have the objects snap to the nearest available socket and float when they encounter the table. However, in the future, I might want to have the size of the table be controlled by the user, so I don’t know how this will work if the table has bones and sockets.
- Put some type of invisible water volume on the table and let the objects float on that. (I’m not sure how to do this and just thought it up while typing this)
What is the best way to do this?
If I do option 1, how do I get the details on all the objects that are already on the table and determine the right position to put the new object?