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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Mesh doesn't follow root component

Hey guys , hope you're fine !

I have a strange problem (maybe not , maybe i forget something) . I create a weapon class (scar) like this :

Scar.h

 /** Collider and root component*/
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = sphereComponent)
     TSubobjectPtr<USphereComponent> root;
 
     /** SkeletalMesh of the weapon */
     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = SkelMeshComponents)
     TSubobjectPtr<USkeletalMeshComponent> Mesh;

Scar.cpp

 AScar::AScar(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
     // Set up the sphere component as root
     root = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("SphereColl"));
     root->SetSphereRadius(0.1f);
     this->SetRootComponent(root);
 
     // Set up the mesh via a constructor helper
     Mesh = PCIP.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("Mesh"));
     const ConstructorHelpers::FObjectFinder<USkeletalMesh> MeshObject(TEXT("/Game/weapon/scar"));
     Mesh->SetSkeletalMesh(MeshObject.Object);
 }
 

But when i create a blueprint derived from this class and add it on the scene , i can move the "Guizmo" but my skeletal Mesh ( the weapon) still on its place , at least i thought at the base coordinates (0,0) , and when i drag'n drop it on the scene , the mesh is directly send at theses base coordinates.

I tried by setting the mesh in the blueprint , but i had the same problem

alt text alt text

Product Version: Not Selected
Tags:
more ▼

asked Nov 27 '14 at 04:54 PM in C++ Programming

avatar image

Madness
58 8 9 13

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

1 answer: sort voted first

I guess you forgot to set root as the parent of Mesh. add this line and I hope it get fixed:

 Mesh->AttachParent = root;

more ▼

answered Nov 30 '14 at 10:00 AM

avatar image

Sachamora
152 14 16 22

avatar image BaderThanBad Nov 30 '14 at 02:18 PM

Mesh->AttachTo(RootComponent);

avatar image Sachamora Nov 30 '14 at 10:09 PM

What ever :P :D

avatar image Madness Dec 01 '14 at 01:41 AM

I will try tomorrow , and tell you if it works

Update : it works ! , thanks "Mesh->AttachParent = root;"

By the way , if i well understood , i can't set the mesh as a root , i need to create a "SceneComponent" ?

avatar image Sachamora Dec 04 '14 at 08:44 AM

it surly has to be a SceneComponent but i guess ActorComponents like Mesh are SceneComponent too.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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