You have the option to “Auto Weld” physics simulating components together into one rigid body (in the details panel). I expect this to do the same thing that happens when I use AttachToComponent and check the “Weld Simulated Bodies” box in blueprint. However, it does completly nothing, while the blueprint option does what I want. It also gets greyed-out when I tick “Simulate Physics” on my component. Please fix.
best regards, Simon
Auto-weld works differently than the Weld Simulated Bodies that is part of the AttachToComponent node. It is used to weld an actor that is not simulating physics to another that is. Because of this it suppose to become grayed out when the component is set to simulate physics.
In 4.14.2 it only becomes grayed out for actors/components that are placed in the world and not for components inside of blueprints. I just entered JIRA UE-40193 to get this fixed.
Thank you very much for your response.
So if I want to construct an actor blueprint with multiple physics simulating components, that are welded together (as in the AttachToComponent node) I can only do that by explicitly calling AttachTo… ? So If I constructed that actor already, but without the welding I would need to re-attach all my components in the blueprint graph? That seems unnecesairily inconvenient.
If so I would like to make the feature request to add an option in the details panel similar to Auto-Weld, that works for physics simulation bodies. Or maybe just make Auto-Weld work for both (implicitly calling AttachToComponent, if the body simulates physics)
I have read not so good stuff about them, especially when handling many interconnected components. I may want to stick maybe 100 different mesh components on an actor which are complete immovable to each other, and have 10 of those actors. I basically only need a common mass, center of mass, and a hitbox for them all. There is no real physics between them. So if welding does some precomputing (which I expect it to do) it would be way more efficient than have the system figure everything out in realtime.
It also seems way less elegant to stick a contraint comp and a mesh comp on the actor instead of just one mesh comp (x100). I thought that was exactly what welding was made for. If it’s not, then what’s it made for?
If you are wanting to construct an actor with multiple physics simulating components, have you tried using Physics Constraints? This is exactly what they are designed for.
I’m a little confused as to what you are trying to accomplish. In the comment above you mentioned:
So if I want to construct an actor blueprint with multiple physics simulating components, that are welded together (as in the AttachToComponent node) I can only do that by explicitly calling AttachTo… ?
But here you mention:
I may want to stick maybe 100 different mesh components on an actor which are complete immovable to each other, and have 10 of those actors.
What exactly are you trying to accomplish? This may help me better understand your expected behavior for welding is.
Ok so here is what I’m trying to do:
I want to build a spaceship, that has components on it that do different things. Some apply forces, some shoot lasers and so on. The ship has a hull mesh, and each component has a mesh. The hull and the components move as one, if a force is applied on one of them, it moves the whole ship, not just one component. I want to have lots of these components. The components still have to process interactions with lasers, bullets and other events independently, but forces are applied on the whole ship.
The components are immovable relative to each other, but they simulate physics in the sense, that the mass of the ship is the mass of its hull + the masses of all components, and that they obviously influence the center of mass with their position. If I stick many heavy components on my ship, then the whole ship becomes heavier.
My expected behaviour is, that I can apply forces on one of those components, and have it applied to the whole. The components should also not move relative to one another, or to the hull. Just like a rocket engine does not fly away from the rocket, even though it has a force applied to it. It instead pushes the whole rocket forward. I thought this was what welding was meant to do (in the sense of welding stuff together).
I tried welding two mesh components together in an empty project and applying forces on either of them makes the whole thing move as expected, so I guess my expected behavior is in line with the engine.
I hope this made it a bit clearer what I’m trying to achieve.
It sounds like the default behavior would work.
Just to make sure, you want a force applied to one of the components (turret) that it applies to the entire ship? Like you mentioned, this is what happens by default when parenting components to the (hull) that is simulating physics.
You can even add in a LineTraceByChannel that will return individual components that can act as lasers and bullets. Something like this:
With default behaviour you mean having the turret not simulating physics, the hull simulating physics, and the hull being parent of the turret? If so, it does nearly work:
I set up a test actor like above, and applied a force to my hull. Everything workes fine, one can clearly observe that the turret has mass and that the hull and turret keep distance and all the stuff I want. However if I change the mass of the turret using “MassInKg” in the details panel, the behaviour doesn’t change. It seems like the turret has a fixed mass that I cannot change.
If we could work out how to change the mass of the turret, this solution would be perfect!
I also forgot to mention: I already have the whole line trace thing with lasers, bullets and impact figured out, no help needed on that. I appreciate the effort though!
Ok so I found out that the mass override only affects the entire body, including attached bodies. So I can only set the mass of the entire thing. That is not very usefull. Is there any way to edit the individual components masses?
I just want to ensure that my overall goal is clear, so here is a more mathematical description:
I expect that when I apply a force on any of my ships components, it is applied on a physical model that:
- has the mass of the sum of all my components masses
- has the center of mass at the point in space that is the average of all components centers of mass weighted by their individual masses
- rotates and moves all components based on the forces that it experiences. So there is no movement of a component relative to another one.
The current solution violates #1 (indivual masses are ignored, I can only set the mass as a whole)
and #2 (I can tell by the movement, that the center of mass is computed based on the individual masses, but I can not set them individually. If I increased the mass of one component, then the overall CoM should move towards it. Right now I can tell that the CoM stays in place if I edit the mass, which I assume is because of #1: I can’t edit individual masses)
I am struggling to find words for this REALLY simple behaviour, sorry i’m not a native speaker. If it’s still not clear what I want I will bring the really heavy guns next time: DRAWINGS
Sorry for the delay.
You can set the mass per component by using a Physical Material Override but the component must be simulating physics for it to have effect. So attaching non-simulating components to a simulating body wouldn’t work.
To accomplish what you want, you would need to use Physics Constraints (this is what they are made for). I know you said you heard bad things about them but I just created a simple version of this in a test project and it works quite well. You just lock all Linear and Angular Limits on the Physics Constraints.
Since this is getting off topic from the original bug report; if you need further help, could you post a new report in the Blueprint section of AnswerHub. Feel free to link this post in the description and PM me a link to the new report over the Forums. I’ll be glad to continue helping if I can.