Download

Modular attachments using blueprints physics problem

Hi all,
I am attempting to make a weapon that is completely modular using blueprints. When holding the weapon in my hands everything works perfectly because physics is turned off. When physics is turned on so that the weapon will drop to the ground either from my inventory or spawning it into the world the attachments swing around the bash mesh. They stay aligned to one another though.

Here is an example: http://imgur.com/a/VE4yi

If I keep physics disabled it will hover in the air and never drop to the ground. I am looking for a way to lock the position of the blueprint attachments to the base mesh so that they stay aligned.

I made sure the collision box also would contain the possible attachments. Now the attachments do not swing around, but, they go to one exact position once dropped. Here is an updated photo of the new behavior.

It will stay in that position relative to the gun regardless how which side the gun is laying.

Let me know if you have any additional questions.

I have the same problem with a project I’m working on and stumbled across your post while trying to research a possible solution. I haven’t come up with a solution yet, but did discover some odd behavior that might help isolate the cause. I tried rotating the weapon model in the level to see if its starting position had an effect on how weapon accessories attached. I didn’t see any noteworthy changes, so I decided to run the level simulation, then keep simulation changes on the weapon once it settled on a surface. When I did that, everything seemed fine until I stopped the level simulation. Instead of remaining in the same position it was in when I saved the simulation changes, it suddenly rotated to a substantially different angle and appeared to change position slightly. I have other objects that save their simulation changes properly, so there seems to be a problem with my weapon. I’m not sure what that problem is yet, but if you haven’t found a solution for your problem, perhaps this will help point you in the right direction.

If you have solved the problem, I’d love to know what you did to fix it. Otherwise, if I make any breakthroughs I’ll post an update.

Did you check “weld simulated bodies” in the “AttachToActor” node? Normally it’s supposed to keep attached actor stick to parent during physics simulation.

Yep, I’ve had that checked for a while, as I found it to be necessary in some of my earlier testing with other test objects. I tried testing with “Weld Simulated Bodies” checked and unchecked, and it doesn’t affect how the attached actor is oriented when enabling physics on the parent actor.

I finally figured out what my problem was. When I was creating the skeleton for my mesh in 3dsMax, I was using dummy objects as bones. Since they tend to look like points in space, it didn’t occur to me to check their orientation. When I created a simple test model to see if I could reproduce the problem, I noticed that in Unreal Engine, the X-axis for the root bone wasn’t pointing down the X-axis of the model. So in 3dsMax, when I set the Reference Coordinate System to Local, I could see that each axis on the root bone was pointing in the same direction as it was in Unreal Engine. I had been adding the dummy objects using a side view window. When I used the top view window instead, each axis lined up correctly, with X pointing forward and Z pointing up. I probably could have rotated the dummy object to the correct orientation, but it was simpler for me to just create a new dummy object and delete the old one. While just fixing the root dummy object was enough to resolve my issue, I suspect I’ll need to fix all the dummy objects if I end up doing anything particularly fancy with attachments.

One other detail that likely contributed to the problem was that in the FBX exporter, under the Axis Conversion setting, the Up Axis was set to Y-Up. I changed it to Z-Up. I noticed this prior to discovering the orientation issue with the dummy object, so this definitely would not have fixed my problem by itself, but it might be the cause of similar alignment issues for other people.