I want to create a wall:
width 6 cubes
height 7 cubes
therefore I have 22 cubes on the margins and 20 cubes inside. For each of the margins cubes(except the corners) I have to set 3 fixed joints, and for the cubes inside the wall I have to set 4 fixed joints - all this to have good physics behavior.
Pretty much I have to create a fixed joint between a cube and all his neighbors => and that's a lot!
Is there a way to automatically create these fixed joints?
Is there another way to create a physics friendly wall? I want to simulate a wall of bricks hited by a projectile.
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
|
|||
|
|
|
I usually don't write code for these questions, but I'm bored. I don't have unity on this computer so I'm just guessing, it should give you an idea even if it doesn't compile. I just added each blocks right and top joint as long as it's not on the top row or far right column. In a real situation you would add the parent transforms x and y position and do all positioning in local space so it can accept the parents transform, but you get the idea I hope.
|
|||
|