x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: https://youtu.be/WK4WGVK1vTQ?t=35m54s. 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:

alt text

Any help will be much appreciated!

Product Version: UE 4.16
Tags:
capture1.png (29.6 kB)
more ▼

asked Sep 04 '17 at 07:42 PM in C++ Programming

avatar image

Deltamike276
13 1 3 5

avatar image Velo Jun 16 '18 at 02:25 PM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question