Hey guys,
I'm creating a building application of sorts, and was hoping someone could provide me with a little advice. It is sort of like an editor, that allows you to take smaller building blocks and hook them together into 2 larger object. The blocks can only hook together on the top and the bottom, i.e kinda like you were building with Legos.
There are a few issues here, but the main one is actually hooking the objects together. Once they snap together, they need to be completely rigid. The only way I could think of to hook them together was a a joint, and i limited the bounds so it couldn't rotate. However when your moving it around, it is very loose and they don't feel like they are actually snapped together.
The next issue is actually figuring out when to snap them together. Currently I am testing for collision. if the angle of each block is roughly the same, and the Y difference of each block is enough so it means one is on top of the other, then the joint is created. The problem is that this doesn't work if the blocks are already rotated, because the y difference won't be enough. Instead of the y difference, I'm guessing I'd have to take the position of the block and extend it out based on the angle using vectors, and then compare that position to the posiiton of the other block. I am ure I could figure this out if I play around with it enough, but any suggestions would be appreciated.
Hopefully this makes sense. Please let me know if you have any input or suggestions.
Thanks,
Sirus
I'm creating a building application of sorts, and was hoping someone could provide me with a little advice. It is sort of like an editor, that allows you to take smaller building blocks and hook them together into 2 larger object. The blocks can only hook together on the top and the bottom, i.e kinda like you were building with Legos.
There are a few issues here, but the main one is actually hooking the objects together. Once they snap together, they need to be completely rigid. The only way I could think of to hook them together was a a joint, and i limited the bounds so it couldn't rotate. However when your moving it around, it is very loose and they don't feel like they are actually snapped together.
The next issue is actually figuring out when to snap them together. Currently I am testing for collision. if the angle of each block is roughly the same, and the Y difference of each block is enough so it means one is on top of the other, then the joint is created. The problem is that this doesn't work if the blocks are already rotated, because the y difference won't be enough. Instead of the y difference, I'm guessing I'd have to take the position of the block and extend it out based on the angle using vectors, and then compare that position to the posiiton of the other block. I am ure I could figure this out if I play around with it enough, but any suggestions would be appreciated.
Hopefully this makes sense. Please let me know if you have any input or suggestions.
Thanks,
Sirus