Product Demo using BGE

Hi. I am a 3d CAD designer but am relatively new to Blender so forgive me if some of the things i want to do are straight forward.

The Project:

The project i am working on at the moment is a product demo for the company i work for. Allowing people with little 3d knowledge to create assemblies of our products in different configurations
The products themselves are modular and fit together almost like a puzzle. The demo will have a floating control panel to the side of the screen and you will be able to click on an icon button and drag and that product will appear so you can place it in the scene. Then you grab another product and place it in the scene or snap it to part of another product.

Products should snap together allowing you to build lots of different configurations.

Other things it should do include being able to save the configuration as you would save a game level. This allows the save to be emailed back to me at the office so i can then export a dxf and dimension a drawing in autocad. Also a print button would be good, and as these products are for the water play industry in leisure centers and swimming pools a tap icon could be used to start water pouring out of the ends.

So the question is:

I think i have the knowledge to do a lot of this, but some of it will be tricky. The snapping together of parts in the game engine for example.
Does anyone have any hits and trick of how to do this?

Sorry for the long post.

Thanks. Oliver.

Could you tell a bit more what things you can and can’t do? :confused: I think the snapping can be done with python, have you got python experience?

I’m new to Blender and Python. But i have found a way to move objects with the mouse using set parent. Also inserting different components into the scene using overlays could be done. But my knowledge of Python is limited

could you please post a blend file of how you did this or explain?
thanks;)

You need the pieces to snap to specific parts of the other pieces. Or snap anywhere their faces touch?

First case would be easy with python. You could just have different empties parented to each piece identifying where each snapping spot is. Then you iterate through the children of the target object checking the distance to each one using KX_GameObject.getDistanceTo() then you just set your .position to the nearest one.

But on the second case it would be a little bit more complicated, you’d need to use .rayCast() to check the collision point to the target object and place yourself there. But depending on your pieces you might need to check for multiple collision points. I’m not sure how to do this myself, would need some experimenting and trial and error.

Here is a very very basic idea of what i want to do.

You see i have 2 objects (the full version would have many). One object is a mast the other an arm.

In this basic setup you can walk forward with W. and pickup the arm with LMB and drop the arm with RMB.

I would like the arm to snap to the mast (blue face to blue face) when you move the arm close to the mast.

also you will see that the oriantation of the arm needs to change to fit the 4 positions of the mast.

I have tried using TRACK TO to align the arm to the mast as you get near to it but this has not worked.

Attachments

rev 1 24 Aug.blend (226 KB)

I liked how you did it to move the object. But is it intended that the dragged object changes orientation with the camera? Maybe you want to change only the position and not the orientation?

In your case you could use empties to snap one thing to another like I said, should be easy. Just place an empty on each snappable face and parent it to the object. Then you check which one is the nearest empty to the object being dragged and just change the .worldPosition to the difference between your object empty and the target object empty.

Thanks for the tips. I am in the process of learning Python for BGE at the moment so will need a bit of time to work out how to implement this.