Helping creating an interactive assembling machine

Greetings,

First of all, I am sorry if I am in the wrong section of the forum.

Hello all, could you help me with some examples/insights in how to do a game where you have some mechanical parts on a table and then you need to click it and put in a specific machine to assembly it and make it operational? Maybe, in the end, just an animation of it working.

It would be something like this: https://www.youtube.com/watch?v=Khvh8vEjm7M But way more simpler, without the VR. I am using the product viewer from unreal studio as my base and trying to understand and modify it now.

Looking forward for your help.
Cheers.

Any ideas? Where should I post this to get more views?

Hi FFehn,

There’s a lot going on in your question. Its typically better to ask how to do smaller tasks rather than how to make almost a whole game :slight_smile:

I’ll try to help point you in the right direction of some tutorials to get you started though

Blueprint basics: This should help you get started with blueprints if you haven’t done this already. Its a little old but probably helpful: https://www.youtube.com/watch?v=EFXMW_UEDco&list=PLZlv_N0_O1gY35ezlSQn1sWOGfh4C7ewO

Intractable Objects: You’ll need this for the player to interact with the objects. https://www.youtube.com/watch?v=4jZT9ibp_ko

Widget Components: This will provide the feedback to the player so the know if they’ve focused on an object. https://www.youtube.com/watch?v=qcRuuKyuE0s

For the animation part, I’m assuming you’ll do that in first person? If so, do you need to have hands and arms? It could simplify things to not and just have the camera and interaction.

Greetings Arlyn,

Thank for your patience. I have a basic knowledge of unreal and I am using the product viewer as base for my project. So I have a camera with wasd movement that I implemented and I can interact with my objects by clicking and holding to change its position. I managed to attached two objects using only collision and sockets, is that enough? What I do is begin overlap, check the class of the object and if it is correct, attachtocomponent. Doing this way, I need to create a blueprint for each mesh of the imported inventor object. All of these blueprints are child of a master object that have the collision and a mesh component to make it easier.

What I need to do now is when it snap to object, I dont want to be possible to move it further with the mouse. I still could not identify the responsible part in the example project code that make the object to move when I click and drag it. Another problem is the location of the snap. I can snap the object in the socket, but If I have like a cylinder in a hole, how can I make that the middle of cylinder snap to the middle of the hole? At the moment, the end of the cylinder is snapping in the middle of the hole. I created a socket in the mesh of the hole to do that. I think its snapping to the end because I am using root component? What should I use to snap in any desired location of the object?

Another thing, for some reason, if I enable physics in these blueprints, they simple disappear. Maybe they fall down and go through the floor? But the floor is block all dynamics collision…It would be interesting if I could click and drag to move the object, but If I let it go, then it would fall down to the floor.

Thanks and sorry if it is not understandable. Let me know if you need more details, I will edit if I have further problems.

Hi FFehn,

No problem we all have to start somewhere!

Can you post a few screen shots of the object blueprints? That would be helpful context.

There are almost no code in the object blueprint. Only the snapping during overlap of collision. Almost everything happens in the pawn. At the moment I just need to make the snapping the in middle of the cylinder and maybe make physics working. Everything else is working like object not moving when attached.

Gotcha, so for the cylinder you’ll need to move the origin to the middle of the static mesh (you can do that in a 3D modeling software)

Right now, your code works by snapping the origin of the static mesh in the Master Object Blueprint to a socket of the “Other Component” in the attach to component node.

What should I do to make the objects stay on the floor and then when I pick up move to the air and let it go it will fall again? Probably I need to setup the physics, but how can I do that?

That’s correct, make sure your the static meshes have collision volumes and are set to block world static and world dynamic. Then try enabling physics again and see what happens. Hopefully that fixes your disappearing problem.

It looks like its working. But first I need to fix the collision sphere. Why my mesh is not in the middle of the collision? I need to fix the mesh somehow? I didnt move the collision sphere…

I need to use blender to recenter all the meshes? Like 90+ meshes…

You’ll need to set up collision on the static meshes themselves, not in the Object BP. You won’t need to do it Blender, UE4 can auto-generate collision hulls. I’d be surprised if it isn’t set up already. Can you post a screen of the collision settings of one of the static meshes?

Thank you very much! Thats why the object was going through the floor:

By default, there is no collision set on this mesh. Without collision, the player would be able to walk through the mesh and if the mesh simulates physics, the mesh would simply fall through the world as soon as play began. You can test this by placing this mesh into your level before setting up collision and playing.

I added the collision on the mesh and now physics is working as intended. However, the origin of the collision in BP to do the overlap all is still in a different origin…

I think this may help you - try doing what this video did for the static meshes. You’ll need to move their pivot points to the center of each mesh. You can also do this in Blender/Maya

Thank you, I used blender to move the pivot and everything works better now. That was a lot of work. Anyway, now because I am using physics, my snap is kind of wierd sometimes. I am using attachtocomponent with simulate physics on. Its possible to use gravity without the simulate physics to avoid this bug during snaps?

You can turn physics on and off during run time. When an object is picked up, try turning off physics and when its let go, turn physics on. Found this example of answer hub… its not exactly what you’re trying to do but I think it at least shows you the node you’ll need: How to disable actor physics via blueprints - World Creation - Unreal Engine Forums

Thank you for your reply. I am already doing that and its very useful. I am having a problem using the attachtocomponent node with physics. I will try to turn off the physics during the attach too.

EDIT: It seems to be working smoothly so far. Thank you for all your help. I will let you know if I bump in any more problems.

Greetings,

I am having two problems at the moment. First, I attach manually BP to a parent BP in the world. After some run testing the game, the actors arent attached anymore. I have no idea why…I cant find any detach node or something similar in the code. Second, the snap on target is working when the collision overlap any part of the mesh of the object. How can I do to work only if overlapping the collision component of the other actor and not the whole mesh?

For some reason, sometimes it does not snap to the socket location. It snaps to inside the object. (wrong z coordinate) - > I fixed by setting actor transform as it should suppose to be just right after the snap…

Any idea? Thanks!

For the first issue, I’m not sure I quite understand. Every time you start a new game, all the actors will be in their original position unless you implement a save system. Is that the issue or is it something else?

For the second, you’ll need to set the collision component for both actors to both generate overlap events and overlap all.

Hope this helps!

In the world, I put several actors as child of one specific actor. But after I play the game and close it, only one of the actors remained as a child. The other actors simply detach from it… It is something from the code?

Thanks for your second tip, that make sense!

Would you be able to post a screen shot or two of how your setting the actors as children? I’m still not quite following and I think that would help,