C++ Skeletal mesh has no gravity or physics

I’m using UE4.16.3 but this problem comes from 4.15,

What I did
I have created a child of pawn class, called it vehicle and then created another child from that and called it plane. I then created sub-objects to populate the blueprint actor such as a camera, skeletal mesh and etc.

Problem:
I want to enable physics and gravity for the plane because the came should realistically simulate drag, lift by using thruster as shown in: Create a Space Flight Physics Simulator in Unreal Engine 4 - YouTube. But my blueprint actor is ignoring gravity, force.

What I tried

  • Changing Root from skeletal mesh component to scene component.

  • Changing physical asset (And yes it simulates perfectly in Physics Assets Previewer)

  • Change Collision to (Vehicle, Pawn, BlockALL)

  • In constructor of airplane:

    • getVehicleBody()->SetSimulatePhysics(true);
    • getVehicleBody()->SetAllBodiesBelowSimulatePhysics(FName(“Root”), true, true);
    • getVehicleBody()->SetEnableGravity(true);
    • getVehicleBody()->SetMobility(EComponentMobility::Movable);
    • getVehicleBody()->WakeAllRigidBodies();
    • getVehicleBody()->WakeRigidBody();

What worked

Creating the entire Plane in blueprint with the exact same settings works perfectly so i’m guessing the problems lies within the way I have used the c++ class.

Header File of Vehicle

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Vehicle")
	class USceneComponent* root;

	// Body of the vehicle
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Vehicle")
	class USkeletalMeshComponent* vehicleBody;

	// Spring arm that will offset the camera
	UPROPERTY(Category = Camera, EditAnywhere,  BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
	class USpringArmComponent* SpringArmIn;

	// Camera component that will be our viewpoint
	UPROPERTY(Category = Camera, EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
	class UCameraComponent* CameraIn;

Airplane:

212244-capture1.png

Any help will be much appreciated!

I am having the same problem. Using C++, I cannot make a separate skeletal mesh on my character fall to the ground via physics/simulation. I am using UE version 4.19.2.

I have a zombie character that has separate skeletal meshes for its limbs (arms, legs, and torso). They are all animated with the same animation blueprint. However, when my main character shoots the zombie, I want the limbs to fall off onto the floor (using physics basically). For some reason, I can’t seem to make the limb properly use physics during play mode/runtime.

I’ve tried several things. Lets use the right arm as an example. My right arm skeletal mesh has a physics asset attached to it. During play mode, using C++, I set collision enabled, then I set simulate physics to true, then I set enable gravity to true as well. This actually does absolutely nothing to make the arm drop out of it’s position on the character. The only setting that changes things is if I set “bNoSkeletonUpdate” on the skeletal mesh to true. Then the arm sits there where it was set and if the zombie “dies”, it does it’s death animation, and the arm remains where it was set to “bNoSkeletonUpdate” (i.e. it hangs in the air motionless while my character animates it’s death).

Now the very interesting thing, is that if I (in the editor during playmode), eject myself from the pawn, click on my zombie, and check or uncheck almost any setting whatsoever, the arm drops out of the air onto the floor like I want it to! Why is this the case? I can’t get it to drop using physics during regular playmode, but if I eject myself and check a setting on it, it drops the way I want lol.

Why does simulating physics, and enabling gravity not work?

Can I completely disable or detach the Animation Blueprint from the skeletal mesh limbs to get them to stop animating, or using animation?

Overall, how can I get my zombie’s limbs to fall off during playmode?