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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

4.21.1 USphereComponent Not Nesting

I'm using 4.21.1 and for whatever reason, the blueprint is re-ordering the sub-components out of order at run-time, not attaching to the correct parent component. The two screenshots display the differences. The blueprint is based on a custom C++ class that inherits from AActor. It was working properly when the Wheel and Axle were UStaticMeshComponent, however now with USphereComponent the blueprint is no longer rendering correctly. As you can see the Wheel at runtime is being nested under MassAxleConstraint which is the root component when it should actually be nested underneath the axle. I attempted doing the same thing with UStaticMeshComponent and it worked fine, for some reason the USphereComponent is causing problems.

Another symptom I am seeing is that at runtime the Wheel Component is staying at 0,0,0 (location), image 3.

In the C++ I had to use Register Component as follows, when I did not use RegisterComponent none of the components worked correctly and physics did not work.:

 // Sets default values
  // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
 PrimaryActorTick.bCanEverTick = true;

 MassAxleConstraint = CreateDefaultSubobject<UPhysicsConstraintComponent>(FName("MassAxleConstraint"));

 Axle = CreateDefaultSubobject<USphereComponent>(FName("Axle"));

 AxleWheelConstraint = CreateDefaultSubobject<UPhysicsConstraintComponent>(FName("AxleWheelConstraint"));
 Wheel = CreateDefaultSubobject<USphereComponent>(FName("Wheel"));

I then in begin play I call the following:

 void ASprungWheel::SetupConstraint()
     UPrimitiveComponent* BodyRoot = Cast<UPrimitiveComponent>(GetAttachParentActor()->GetRootComponent());
     if(!BodyRoot) { return; }
     // First Constraint Setup BodyRoot -> Axle
     MassAxleConstraint->SetConstrainedComponents(BodyRoot, NAME_None, Axle, NAME_None);
     // Second Constraint Setup Axle -> Wheel
     AxleWheelConstraint->SetConstrainedComponents(Axle, NAME_None,  Wheel, NAME_None);


Correct Component Ordering and Nesting Runtime Component Ordering Wheel component stuck at 0,0,0

Product Version: UE 4.21
more ▼

asked Dec 18 '18 at 04:03 PM in C++ Programming

avatar image

Disciple of One

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I got the same problem and i lost 3 days Trying to fix it without success. it got same problem with ALL the kind of bounding box.. sphere box.. capsule.. and of course it work with mesh

more ▼

answered Jan 06 '19 at 05:48 PM

avatar image


(comments are locked)
10|2000 characters needed characters left
Your answer
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