Is there another way to "weld" physics enabled static meshes together, or am I using constraints wrong?

So after much experimentation with the constraints I’ve come across a problem. What I am trying to do is weld (aka fully constrain 2 objects solidly) multiple physics enabled objects together. Doing this with 2 objects works alright. However constraining a group of objects together introduces a lot of wiggle.

This was somewhat expected, as the constraints are fighting with each other. So my question is: Is there another way to “weld” physics enabled static meshes together, or am I using constraints wrong? Thanks!

-Rob

“Is there another way to “weld” physics enabled static meshes together”

#AActor::AttachRootComponentToActor

/**
	 * Attaches the RootComponent of this Actor to the RootComponent of the supplied actor, optionally at a named socket.
	 * @param InParentActor				Actor to attach this actor's RootComponent to
	 * @param InSocketName				Socket name to attach to, if any
	 * @param AttachLocationType	Type of attachment, AbsoluteWorld to keep its world position, RelativeOffset to keep the object's relative offset and SnapTo to snap to the new parent.
	 */
	UFUNCTION(BlueprintCallable, meta=(FriendlyName = "AttachActorToActor", AttachLocationType="KeepRelativeOffset"), Category="Transform|Actor")
	void AttachRootComponentToActor(AActor* InParentActor, FName InSocketName = NAME_None, EAttachLocation::Type AttachLocationType = EAttachLocation::KeepRelativeOffset);

This will weld as many Actors as you want to another actor!

There will be no wiggle, but each actor can only be attached to 1 other actor.

#Detaching

You can detach any time!

/** 
	 *  Detaches the RootComponent of this Actor from any SceneComponent it is currently attached to. 
	 *   @param bMaintainWorldTransform	If true, update the relative location/rotation of this component to keep its world position the same
	 */
	UFUNCTION(BlueprintCallable, meta=(FriendlyName = "DetachActorFromActor"), Category="Transform|Actor")
	void DetachRootComponentFromParent(bool bMaintainWorldPosition = true);

Won’t this make the child object lose it’s physics? Meaning if I attach object B to object A, object B will stop interacting with the world physically, and object A will be the dominate physics object. What I’m looking for is a way to attach multiple objects together such that each object maintains it’s physics and collision.

For example, lets say I wanted to take multiple cubes and attach them to one another in the form of a sphere of cubes. (I believe) in your example if I tried to roll the sphere of cubes all but 1 cube (the root) would fall through the world.

Hi Rob,

If I understand you correctly you would like to essentially attach several physically simulated objects together and have them act as one solid rigid body. This is a feature we are currently looking into and would definitely like to add.

I’ll keep you posted on this as it’s something I’ve been experimenting with. Let me know if you have any more questions or suggestions about this!

Hi Ori,

Yes! This is exactly what I had in mind.

In the past (using UDK) I had tried combining the actual collision component data, but the result was hacky, and of course you’d lose individual physical material properties, as it’d just behave as 1 object with 1 physical material, amongst other problems.

Please do let me know if you progress on this, thanks a lot!

I tried to use that attach function in multiple ways without ever seeing it doing anything at all. I know that to grab an object I had to use a PhysicsHandle and manually update the position in Tick. But as that AttachActorToActor (in BP) function seems to take a positioning argument I thought it would update automatically (like a model with bones) but it doesn’t.

Meaning that this is totally useless:

http://puu.sh/8pJNp.png

By adding a PhysicsHandle to the parent I could not move the child away. The parent could be moved but the child wouldn’t move with it. Rama could you please enlight us here ?

I tested this, it work to well (thanks to Rama):

Has there been any change to this situation? Is there a solution to this yet?

Sort of. You can weld objects together by making them a child of a singular parent object and then setting “Auto-Weld” to true in the physics category. There will be no wiggle at all.

However, all child objects will inherit the weight and physics material of the parent object. And as far as I know there is no fix for that. So it’s not perfect.

It’s been 4 years since this question was asked, is this feature ever going to be implemented?

3 Likes