My "wheel" won't fall

My version of the Sprung Wheel isn’t falling to the ground like in the video, it remains floating in the air.

As far as I can tell, all my settings on the Wheel match the settings in the video.

However, when I push play my cubes float mid air instead of falling to the ground.

My Wheel is has “Simulate Physics”, it has a mass, it has Enable Gravity on, Collision Presets is set to PhysicsActor.

I can’t spot any differences in my code. Anyone know why the cube isn’t falling?

More clues:
When I first attempted to test the changes, I got an error that the SpawnPoint0-3 components we created couldn’t be attached because they weren’t static. I changed them from “Moveable” to “Static” and the error cleared up. This step isn’t being done in the video. Is it possible I’m missing some setting that would allow them to be attached as moveable components?

My tank no longer falls at all, but when it gets hit the four floating boxes will jiggle downards. This tells me that physics is affecting this spring, but it’s floating so the springs only react when outside physics forces are hitting it.

I tried recreating the spring from scratch, it works with gravity, and then I convert it to C++.

In this step, at the same time I add all the code up through 219 on my new remake of the class, and I delete the mass. (I never set mass as the root, I just started with the physics constraint as the root the entire time. This doesn’t seem to have any impact on its ability to work with gravity while constructing the remake of the spring.)

As soon as I delete the mass, the lower cube no longer falls to the ground. I can add the cube back, and the spring will once again fall.

This tells me that the root problem is likely that the tank isn’t getting properly attached to the physics constraint.

Still no luck. I tried totally recreating the entire SprungWheel apparatus and my tank is still not falling.

A) When testing with Physics Constraints, I found that the cube won’t fall if the other cube on the physics constraint is missing.
B) I added additional logging to verify that the GetAttachParent() is able to find the tank, and that the BodyRoot variable we created is able to find the body root before attaching it to the physics constraint.
Proof:

C) When I select the SprungWheel blueprint object while the game is running, I don’t see that it has any attachments! Manually setting these attachments at run time had no impact.

My C++ code matches the code from the git repo, except with extra log lines added. I am using UE v4.19.2.

Has anyone gotten this to work? When you depossess do you see that it has the constraint actors 1 and 2 properly set?

void ASprungWheelRM::SetupConstraint()
{
	if (!GetAttachParentActor()) return;
	UPrimitiveComponent* BodyRoot = Cast<UPrimitiveComponent>(GetAttachParentActor()->GetRootComponent());
	if (!BodyRoot)
	{
		UE_LOG(LogTemp, Warning, TEXT("(RM) No body root!"));
		return;
	}
	else
	{
		UE_LOG(LogTemp, Warning, TEXT("(RM) Body root found"));
	}
	MassWheelConstraint->SetConstrainedComponents(BodyRoot, NAME_None, Wheel, NAME_None);
}

SOLVED.

Turns out my Tank_BP had somehow had “Simulate Physics” disabled.

I think I may have turned it off while troubleshooting errors with the first SprungWheel I created, it wasn’t attaching or finding the parent properly so physics wasn’t working. I turned off “Simulate Physics” at some point while troubleshooting.

Then, I recreated the SprungWheel from scratch and this time on remake it didn’t have any issues finding the parent or attaching. I never figured out why the first SprungWheel couldn’t find the parent. But, even though SprungWheel was now working, the tank had “Simulate Physics” off which happens to present the exact same symptoms as when the SprungWheel fails to attach two meshes together.

I had the same issue, turns out I did not simulate physics on wheel inside sprungWheel Blueprint.

Privacy & Terms