Attaching without welding?

I’m having a HUGE amount of trouble trying to do something that I thought was initially quite simple. Basically I have a ship, and I want to attach equipment to it. I would like to retain the individual collision properties on each object, and have the equipment rotate with the ship, as if it really is attached to it. The problem is that every time I try something, it screws something else up. Here’s what I’ve tried so far - can anyone give me some tips?

Attempt 1: AttachTo with no weld - the equipment just floats away in space.

Attempt 2: AttachTo with weld - the equipment is now attached. When I apply a torque it translates the ship as well as rotates it, so something funny is going on. What’s really odd is that the translation only happens with a -ve torque. If I apply a +ve torque then it rotates with no translation. I can see the center of mass has changed (even though the equipment has mass = 0). I changed it back using physx code to the original location, no difference. I tried setting the Inertia tensor also but same behaviour. I also tried creating a ApplyTorqueAtLocation() fn, and ran it on the center of mass - still getting a translation component.

Attempt 3: Tried turning off collision in the equipment by using OverlapAll - this actually seems to produce the desired behaviour, except that the equipment no longer blocks anything.

I’m starting to think that all of the problems are due to trying to attach something. Does anyone have any workarounds, or any other alternatives besides attach? Should I just not attach them and update their positions manually each tick?

Turns out that the equipment I was attaching was self-intersecting, but only when I moved in a certain direction. I guess that welding things doesn’t move things synchronously, hence the problem.

Setup a Collision Profile for your Attached Objects and your Ship. You can then set it in C++ using SetCollisionProfileName() in your Constructor for each specific collision primitive.


SetCollisionProfileName(TEXT"Name");

Hi , Thanks for the suggestion. I ran into a bug with any custom profiles not being visible in the editor which left me with hand editing text files. Either way I had other issues with welding - mainly that the mass of the object was behaving incorrectly. I attached an object of mass = 0. It moved with the ship as if it was light, but when it hit objects it would send them flying away like it had m > 100,000 kg.

I ended up abandoning welding and now just use a physics constraint which seems to have fixed a lot of issues.