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"

How can I attach 2 actor components?

Hi, my actor has 2 components

1 static mesh component and another capsule component.

The static mesh component is responsible for physics simulation and the capsule component is used for another specific action non-related to physics.

I want the capsule component to stay attached to the static mesh component. I have added the capsule component by code and static mesh component by blueprints. So the capsule component is the root.

One solution i can think of is moving the capsule component in each tick update to the location of static mesh component. But that would require to add the static mesh component by code. Is their an easier solution for this?

Product Version: Not Selected
Tags:
more ▼

asked May 12 '14 at 09:34 AM in C++ Programming

avatar image

envenger
418 77 117 146

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

1 answer: sort voted first

The easiest way is just to parent the capsule under the static mesh. You do this by just dragging the capsule and dropping in on the static mesh in the heirachy.

more ▼

answered May 12 '14 at 10:49 AM

avatar image

Visceral3D
247 13 10 21

avatar image envenger May 12 '14 at 12:42 PM

I couldn't do it as the capsule was the root component.

So I had to code it. Something like this and worked.

     BaseMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("BaseMesh"));        // only the owning player will see this mesh
     RootComponent = BaseMesh;
     FVector NewScale(1.5, 1.5, 0.25);
     BaseMesh->SetRelativeScale3D(NewScale);
 
     CollisionComp = PCIP.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT("CapsuleComp"));
     CollisionComp->InitCapsuleSize(90, 170);
     CollisionComp->BodyInstance.SetCollisionProfileName("OverlapAll");
     CollisionComp->OnComponentBeginOverlap.AddDynamic(this, &ATeleporter::OnOverlap);        // set up a notification for when this component overlaps something
     CollisionComp->AttachParent = BaseMesh;

(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