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. 

Modular pawn skeleton components out of position

I am creating a modular pawn by adding 2 meshes with same skeleton together using a ACharacter class in C++.

I use the following code :

 headAndArmsComponent->SetSkeletalMesh(HeadAndArmsMesh);
 headAndArmsComponent->SetMasterPoseComponent(GetMesh());
 headAndArmsComponent->AttachParent = GetMesh();

however when the player spawns the Head is way far in the air from the rest of the body, however the animations runs correctly (With head still in air) and it also follows the parent mesh's rotation

Although adding components in persona animation viewer works correctly

Product Version: Not Selected
Tags:
more ▼

asked Jan 20 '15 at 02:43 PM in C++ Programming

avatar image

Commander Shepard
797 62 82 219

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

2 answers: sort voted first

LOL I'm stupid! All I had to do was set the child skeletal mesh component position to that of parent mesh component.

By default the Engine creates each new component at world origin and then the actor keeps that as the relative position

In short I had to add the following line

 headAndArmsComponent->SetWorldLocation(GetMesh()->GetComponentLocation(), false);

where GetMesh() gives the default/parent Mesh component in a ACharacter class!

Hope this will help future new comers

more ▼

answered Jan 20 '15 at 04:53 PM

avatar image

Commander Shepard
797 62 82 219

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

Thanks for the info! Just to clarify does this allow you to swap out the "head and arms" of you character? I am wanting to implement an armor system where people can equip helmets and chest armor. Just wondering if this is the way to do it. Thanks!

more ▼

answered Mar 10 '15 at 05:18 PM

avatar image

Janyx
492 66 64 211

avatar image Commander Shepard Mar 11 '15 at 06:07 PM

well yes you can for sure, but you'll need to call following each time you wish to change the heads and arms (In your case the armor)

 headAndArmsComponent->SetSkeletalMesh(HeadAndArmsMesh);  


(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