Constraints when modelling Lego-like building
09 July 2015 09:34
Hi all,
I am a newbie and researching how best to go about creating an application that will allow users to construct a steel building framework by assembling 'modules' which are prisms with many flat faces based on an octahedral form. These prisms would be assembled on top and beside each other via connecting at the flat faces of adjoining prisms, a little like you assemble Lego building blocks but with more options for connection.
An important functional requirement would be for the blocks to 'snap' to each other when the relevant faces got in close proximity. I am presuming that I would need to use constraints to achieve this and wonderd if the current set of constraints in BFW can do this? If not, what is my best course of action?
Appreciate any guidance you might be able to give!
I am a newbie and researching how best to go about creating an application that will allow users to construct a steel building framework by assembling 'modules' which are prisms with many flat faces based on an octahedral form. These prisms would be assembled on top and beside each other via connecting at the flat faces of adjoining prisms, a little like you assemble Lego building blocks but with more options for connection.
An important functional requirement would be for the blocks to 'snap' to each other when the relevant faces got in close proximity. I am presuming that I would need to use constraints to achieve this and wonderd if the current set of constraints in BFW can do this? If not, what is my best course of action?
Appreciate any guidance you might be able to give!
09 July 2015 12:39
Hi, and welcome to our forum!
This is kinda architectural question by I'll try to give my suggestions.
I think, your task will require raycasting and constraints, as you mentioned above. Something similar is done in our new raycast demo. The difference is that you will need to use permanent raycasting, and you will need to replace mousedown event with mousemove.
As of constraints I think there are many ways to solve this. The first thing that came to mind is to compare position returned by raycasting with predefined positions specific to the block that was hit by the ray. And if the distance is small enough - snap the object to one of these positions. Something like this.
This method imposes some requirements to the blocks-objects. They should use physics and should be Static ones (if you don't need to create some kind of building explosions after it is constructed ). You can read about physics here.
This is kinda architectural question by I'll try to give my suggestions.
I think, your task will require raycasting and constraints, as you mentioned above. Something similar is done in our new raycast demo. The difference is that you will need to use permanent raycasting, and you will need to replace mousedown event with mousemove.
As of constraints I think there are many ways to solve this. The first thing that came to mind is to compare position returned by raycasting with predefined positions specific to the block that was hit by the ray. And if the distance is small enough - snap the object to one of these positions. Something like this.
This method imposes some requirements to the blocks-objects. They should use physics and should be Static ones (if you don't need to create some kind of building explosions after it is constructed ). You can read about physics here.
09 July 2015 14:59