Conceptual question about building molecules

Hi all

I am putting together a molecule building game/prototype. I have the basic building blocks all there, so “atom” gameobjects create joints to connect to each other etc.

What I am struggling with is a good approach to detecting what molecules are connected with each other and then how to work out when a certain atomic combination has been reached, in this example it is water.

So my general thinking is when one atom connects with another a group is formed (maybe a list or an array and searching by tag?) then when others are added they also join this “group” with a manager running in update() constantly checking these groups to see if a molecule is created.

I have thought about creating a list when one connection is made for example, but then would I need to create a list based off that initial connection? For example, I want to also be able to create an oxygen molecule (2 oxygen atoms) so if the group included an oxygen and hydrogen atom, the manager would need to know the difference of what is in the group and react accordingly.

I’m still fairly new to c# so I think it’s just a case of missing some framework knowledge. So if anyone can point me in a general direction to research that would be great.

I hope my ramblings make sense.

cheers

Matt

Hey man, I want to import .mol or similar files into the unity editor, did you figure something out?

Holy necro-post, Batman!

I’m sorry I missed this post in 2013, as it’s an interesting question and I could have helped. It looks like poor @mattratcliffe_1 didn’t get the help he was looking for, and most likely is no longer around.

Your question is quite different, though. Importing .mol or similar has very little to do with the book-keeping involved in tracking and combining groups of objects. What exactly are you trying to do, and why (what’s the big picture)? What have you tried so far?

1 Like