Download

Need advice on sockets, meshes and combining actors

I’m trying to figure out the correct way to properly create an aircraft actor.

Here’s what I have:
A mesh of an aircraft, with landing gear. I’ve rigged the mesh with bones (control surfaces, landing gear) and animated the landing gear. I’m importing this as a skeletal mesh into UE4. I then intend to create a blueprint where I handle running the animations and rotating the control surface bones.

Here’s what I need:
The aircraft needs to have hardpoints for missiles and bombs. I need to be able to attach missiles/bombs (other Actors) into the hardpoints from the blueprint/code, and also be able to detach them.

And here’s the problem:
I’m having hard time figuring out the correct way to implement the hardpoints. Here’s what I’ve tried:

I added dummy objects to the mesh in 3DS Max. I used to define the hardpoints this way in Unity (I could then access the sub objects of the imported mesh, find out their names and positions etc.). Unfortunately UE4 does not import any “metadata”, meaning that all that comes out is one mesh. So no dummy objects and no way to access them. :frowning:
From that I figured that creating the hardpoints as extra geometry / separate dummy meshes is also out of the question (and would be a pain in the **** to do).

I can see there are sockets and the documentation describes them pretty as exactly what I need. I can add them to bones but in this case it only makes sense to add them to the root bone. Also requires me to painstakingly move each socket to their place where the mounting of the missile/bomb should be. Not to mention that, say if you have ~20-30 aircraft you need to rig that way… well, I’d rather not. I’d rather do this kind of stuff straight in 3DS Max where I could fit and test each separate mesh component in the correct place and then determine the attach points there and, like previously stated, carry that information over in dummy objects. Besides, I’d like to have a SINGLE blueprint for ALL aircraft, with each different type being generated from data with the mesh filled in, hardpoints filled in, etc…

I’m thinking I need to export the hardpoint positions as metadata, separate from the FBX, and forget about sockets as I don’t think I can create them from code or blueprint anyways.
So I guess I just answered my own question and I’ll just have to create a script to export the hardpoint positions and rotations from 3DS Max, and then read that data when constructing the actor. Any better suggestions?

Have you tried just attaching the missiles, etc. as an additional child component?

If you have your aircraft as a blueprint and go under the components section you can add additional components and drop them over your (Root) carrier as a child component. You can also reference those child components from inside the blueprint graph.

I had a similar dilemma and immediately thought to use sockets too. But I found this way to be much easier for my needs. Sockets may be easier in your case though. This is just another idea about how to possibly go about doing it.

I cant see the problem with adding some extra bones for the hardpoints and then adding a socket to each hardpoint bone. Adding a bone or adding a extra “metadata mesh” should be the same effort(?).

Using sockets doesn’t preclude being able to do it with a single BP. Although it would be cool if the FBX importer took bones named SOCKET_XXXXX and auto-created sockets for you.

Actually attaching as components is probably what I’ll do. The biggest issue was getting the locations for the missiles correct - ie. I couldn’t just export the data in the mesh. I just wrote a MaxScript a moment ago to export the positions and rotations of all hardpoints, which I’d then add to the aircraft data (in an SQLite database file). Then when I create an aircraft, I create an array of hardpoint components in their right places according to the data and then populate those with missiles.

This is all still theoretical though as I’m still figuring out all the infrastructure around my little game prototype but I think this is probably the right way to go.

The sockets are with the skeleton, so you can add the socket to the skeleton add change the mesh inside the BP on the fly. So that shouldn’t be a problem to use only one BP with it.