Add Physics Constraint Component Node causes a warning

Using UE14.3 Preview 2, Windows 10 64-bit.

I’m using the Add Physics Constraint Component blueprint node, followed by Set Constrained Components to dynamically add a constraint to my Blueprint actor in the Event BeginPlay graph (note - in the screenshot I’ve removed the two components that I plug in to the Set Constrained Components node);

In UE14.12 this worked fine. In UE14.13 Preview 1, and in Preview 2, the constraint still works, but now I get a warning in the Message Log; Warning Constraint MyActor_C_0 attempting to create a joint between two null actors. The Add Physics Constraint Component node is the one causing this warning.

I understand that when I create the constraint, the constrained actors might be null until I set them, but Blueprint doesn’t provide me a way of setting those actors as I create the constraint - so I’m stuck with the annoying warning. I’d consider this a bug, unless there is a way of flagging a blueprint to ignore certain warnings.

To replicate;

  1. Create a new Blueprint Actor or Pawn.
  2. Go into the Event Graph
  3. From Event BeginPlay add a Add Physics Constraint Component node.
  4. Play in editor
  5. Stop playing and inspect the message log

Thanks,

Hi 6ead2ebf,

This warning is now expected behavior, it was added for 4.13.

We do have a feature request in for the ability to disable warning messages like these. It’s UE-33395 and you can follow that link to monitor it’s progress on the public bug tracker.

Cheers,

TJ

Thanks for the clarification TJ! I’ve voted for the bug. Appreciate your time.

In using the release version of 4.13 I’m seeing these exact same warnings. Unfortunately, they show up every single time I try my game in PIE/VR Preview. They are not just in the console log, which I could ignore, but they also force a warning message popup every time I quit PIE.

If this is now expected behavior, then what is the proper set up so that I don’t get these warnings? I can’t believe that this is just the way things are when working with Physics Constraints across all projects now.

For reference, I’m using the Physics Constraint Component in two ways. The first is by having it be a component of the actor as added in the editor. In this case, the component just hangs around until I need to use it (at which time I connect up the constrained components).

The second way is similar to the OP. I’m creating a Physics Constraint Component during the actor’s BeginPlay and then immediately connecting up the constrained components. See the image below.

In both of these cases, I’m receiving the warning:

PIE:Warning: Warning Constraint BP_PhysicsConstraintTest_270 attempting to create a joint between two null actors.

and getting the error/warning popup after quitting PIE. In 4.13, how do we correctly now use the Physics Constraint Component so that these warnings do not occur?

Hey Gnometech,

I tested this just now and noticed that when I had the same setup in my Actor’s construction script the error did not appear. Is this something that you would be able to do in your project?

Hi .

On testing with the AddPhysicsConstraintComponent node within an Actor’s construction script, it looks like it doesn’t produce the “null actors” warning. This was by moving the nodes I showed above into the construction script (including the SetConstrainedComponents call).

However, if I call AddPhysicsConstraintComponent within an Actor’s construction script, but then wait to call SetConstrainedComponents until later (such as BeginPlay) then I do get the warning.

So with the four methods of using a physics constraint component we have:

  • Add component and set constrained in
    Construction Script: No warning
  • Add component in Construction Script,
    call set constrained later:
    Warning
  • Add component outside of Construction
    Script: Warning
  • Make use of a component added with
    the Blueprint editor: Warning

In summary, unless you are adding the Physics Constraint Component in the Construction Script, and also calling SetConstrainedComponents within the Construction Script, you will get a “null actor” warning that always produces the Error/Warning popup following any PIE session.

I’m really hoping that this is considered a bug. Having to deal with the Error/Warning popup through what should be considered normal use of the Physics Constraint Component in 4.13 is both annoying, and masks real errors/warnings as you end up never looking at the message log due to so many false positives.

Plus sending 4.13 builds to a client that contain these warnings never looks good. :frowning:

Hey Gnometech,

I have gone ahead and entered a bug report, which you can track the status of here: Unreal Engine Issues and Bug Tracker (UE-36089)

Have a great day!

We want to create constraints at runtime but we get warnings that have no relevance. This is a bug, plain and simple. All you have to do is add a checkbox that gives us “manual constraint” the way we have a checkbox for “manual attachment”.

If you don’t mind editing the engine source, the solution is fairly simple to implement. Epic should be doing this in the official source but you can do it yourself until they do.

In “PhysicsConstraintComponent.h” add these lines to the UPhysicsConstraintComponent class.

	/** Whether to automatically or manually constrain.  */
	UPROPERTY(EditInstanceOnly, Category = Constraint)
	bool bManualConstraint;

In “PhysicsConstraintComponent.cpp”, add this line to the UPhysicsConstraintComponent constructor (to be safe).

bManualConstraint = false;

In “PhysicsConstraintComponent.cpp”, within the InitializeComponent() function, change the call to InitComponentConstraint() so it is only called if our bool is false.

	if(!bManualConstraint)
		InitComponentConstraint();

Compile and run the editor. Now all of your AddPhysicsConstraintComponent nodes will have a new checkbox in their details panel. If you set them all to true then the warnings should go away.

I implemented this solution and it works well. I posted it in it an answer below for anyone who is more annoyed by the warnings than by modifying the engine source. Hopefully, Epic will implement this someday, or I guess I could do it if Epic said it was an acceptable change.

getting the same annoying warning – the constraint works fine, but the error keeps popping up every time i run in PIE

i clicked “vote” on the existing bug, but I am not sure if I am thumbs-upping, or flagging for someone to look at the bug report. hopefully someone looks into this :slight_smile:

Workaround for my very specific case where I create a new joint in runtime

had this code:

joint = NewObject<UPhysicsConstraintComponent>(this);

joint->AttachToComponent(this, FAttachmentTransformRules::KeepRelativeTransform);
joint->RegisterComponent();

joint->SetConstrainedComponents(this, FName(), component, FName());

changed to this:

joint = NewObject<UPhysicsConstraintComponent>(this);

joint->SetConstrainedComponents(this, FName(), component, FName());

joint->AttachToComponent(this, FAttachmentTransformRules::KeepRelativeTransform);
joint->RegisterComponent();

this is not fixed. Still happens in 4.18

Are you sure it’s the same warning? I can see that the warning we were talking about doesn’t exist in the source anymore. I think they should have left it and implemented my solution but it looks like they at least stopped this particular warning from happening. There are three warnings now: one says “between two actors in different scenes”, one says “between objects that are both static” and one says “to the same body”. What are you seeing?

sorry. I should have paid more attention to the bug report status. It is different. My message is from a constraint component added to a BP actor and the message says it can´t find the bone of the second actor. but it works and the bone is there with exactly same name… sorry again

Hey no problem at all. That’s why we’re here to help each other. Easy mistake and one I’m sure I’ve made myself. If you still think there’s a problem and can’t find a solution, be sure to post a new question and link it here.

Hi guys, i’m Having this same issue where you get this Warning “Both components are static. No joint created” when both meshes are movable.

Checked in 4.21.1 and 4.19.2

Any new ideas to fix it?