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"

Collision and child actor

Greetings !

I am experiencing a weird behavior where the child actor gets misplaced upon spawning

This is my components' hierarchy : alt text

So I have TankBody, which is a skeleton mesh that has physics asset attached, Cannon spawner which is a Child actor component that is there to spawn the cannon for the tank. it is attached to the tankbody so it moves with it.

This is the rig before I press simulate/play: alt text

This is the rig after i press simulate/play: alt text

(The spawned cannon is misplaced and rotated, its not aligned correctly with the tank, I am talking about the one on the left, since the one on the right is a bug with displaying, so its not really hurtful)

Any help please???

Product Version: UE 4.7
Tags:
more ▼

asked May 22 '15 at 10:51 AM in Bug Reports

avatar image

FrostSnake
62 7 11 14

avatar image Matt.Williams May 27 '15 at 08:51 PM

Hey FrostSnake,

When you Play, are you doing any network operations? We've seen similar issues for client sessions.

-Matt W.

avatar image FrostSnake May 28 '15 at 05:33 AM

No not at all

The tank mesh (which is a skeletal mesh) is being placed correctly, the problem is with the child actor (cannon) being rotated and shifted.

If i set the collision preset on the Tank to "NoCollision", the cannon will be spawned in the right rotation and location. so i guess its a problem with spawning and collision

avatar image Matt.Williams May 28 '15 at 03:10 PM

Now that I remember, there was a bug found in 4.7 where any modifications made to inherited components were not showing in game.

See this post

This is fixed in 4.8, but in the meantime there is a workaround. Remove the cannon component from the parent blueprint and implement it in the child BP as a new component. I know that can be a hassle if you have a lot of them, but could you try it with one to confirm that it's the same bug? Either that or convert A COPY of your project to 4.8 preview 4 and see if it works there

HOWEVER, I would suggest waiting until 4.8 release and maybe a few hotfixes before you actually continue full development in 4.8.

-Matt W.

avatar image FrostSnake May 28 '15 at 10:42 PM

i tried it using 4.8 preview 4, still buggy.

Im pretty sure that it has to do with collision, because if i set the collision preset of the tank body to "No collision", the cannon will be created correctly, as if the collision asset of the tank body pushes the cannon away upon spawn.

avatar image Matt.Williams May 29 '15 at 04:07 PM

Does the canon have "simulate physics" enabled?

I would like to see if you could send an example project with these assets to me. You can upload to google drive, dropbox, etc and PM me the link on the forums. Please include a link to this Answerhub thread in your PM.

avatar image FrostSnake May 29 '15 at 07:42 PM

yes i have simulate physics enabled.

I guess i found the source of the issue, its from the rig of the tank body.

like, The root bone is placed behind the tank, and it is rotated toward where the mislocated cannon is facing. Since the cannon AND the tank are inherited from a c++ code, i could not set the cannon to attach "body" bone, and it gets automatically attached to the root as i guess, which is weird.

I have no idea why does the physics asset uses the root as a pivot point, i thought it uses center of mass instead :/

I tried to edit the location of the bone in blender and re-export it back, and after few edit and try i got it to work as intended, its a bit tedious lol (we should get a rigging best practice tutorial for unreal engine 4).

By any means, do you have any idea why i cant see bones of the parent skeleton mesh when it is inherited from c++ parent class? like, if i create the skeleton mesh using blueprint, and attach a child to it, and use the attach to bone, i would see the skeleton mesh's bones, but not when it is inherited from c++

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

2 answers: sort voted first

Hey FrostSnake,

So we were only creating the parent in code. We've now created the child and defined the parent socket in code. It's one of the parameters you set when you perform an AttachTo operation. We don't expose the ParentSocket field when a component is inherited from a code class. Sorry for any confusion.

 TheChildActor = CreateDefaultSubobject<UChildActorComponent>(TEXT("TheChildActor"));
 TheChildActor->AttachTo(TheSkelMesh, "SOCKET_NAME");
 TheChildActor->AddRelativeRotation(FRotator(90.f, 90.f, 0.f));

SOCKET_NAME being your desired bone to attach to. In this case, we used "body" and then rotated the component properly. You could create a socket instead with the correct rotation and use that in place of SOCKET_NAME (and then delete the third line). Using a socket instead would be ideal in the long run if you want to have multiple tank types that require a unique cannon location.

Hope that helps.

-Matt W.

more ▼

answered Jun 10 '15 at 05:18 PM

avatar image FrostSnake Jun 10 '15 at 05:38 PM

Oh, thanks for clearing it out, yes it is a bit confusing.

anyway, back to the main problem, it was that the root bone wasnt aligned with the tank, and whenever the cannon gets attached to it, it follows the root's alignment. I fixed that by editing the rig and fix the alignment.

When i first reported that, I did not know that the cannon gets attached to bones, i thought it gets attached to the component or to the tank itself, but I was wrong.

Anyway, thanks for your help, and sorry about reporting this. I should have investigated more.

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

Hey FrostSnake,

I have discussed this with some engineers and have entered this bug as UE-16567.

-Matt W.

more ▼

answered Jun 04 '15 at 02:54 PM

avatar image FrostSnake Jun 04 '15 at 03:27 PM

Okay thanks !

Just for people who might have the same issue: make sure you have your root bone in the middle of your vehicle or whatever, and to be aligned correctly with the world, since the physics asset will use the root as a pivot point

avatar image Matt.Williams Jun 05 '15 at 10:38 PM

Hey FrostSnake,

There was some further discussion and we were wondering if we could get a copy of some of your assets or a snippet of code from you.

-Matt W.

EDIT: You can Private Message me on the forums

avatar image FrostSnake Jun 05 '15 at 10:50 PM

I have edited my model so it works, but i know how to reproduce it anyway.

I can send you an fbx and tell you steps on how to reproduce it.

I will do that once i edit the model, and i will send it to you via Private message

avatar image Matt.Williams Jun 08 '15 at 08:53 PM

So now that I'm sitting down with the blueprint, I see that it isn't appearing in the right location. However, I was able to remedy that. I don't know if these will work for what you're trying to do.

By a few methods I was able to position the canon. One way was to attach directly to a bone that isn't the root from the component details. Using the Parent Socket section. Then you position the Child actor relative to the bone. In my case I used the "body" bone as it seemed most appropriate. Then I just rotated the ChildActor into place.

The other way was to create a socket on the skeleton in Persona, position it correctly and then just use the socket instead of "body" in the Parent Socket slot.

I would suggest actually making a specific bone to attach the cannon to, this way you can control some motions through Animation Blueprints.

The internal discussion on this kind of got a little muddled, so I'm a little lost on where the bug is here anymore.

avatar image FrostSnake Jun 09 '15 at 05:20 AM

As i said previously, I thought that the bug is related to physics asset, but i did some further investigations, and found out that child actor is being attached to the root bone by default when you dont assign a bone in the parent socket section (some misconception error, since i thought it should be attached to the center of mass).

Now the real bug is that, IF your parent skeletal mesh was inherited from a c++ class , you will not be able to neither write the name of the bone in parent socket section, nor find it via the finder (it will be empty).

In the example i gave you, it was straight forward, not inherited, thus the bug didnt occur, you can try it in the same project and see:

-Create a c++ actor. -Give it a skeletal mesh as root component. -Now create a blueprint actor, and made it a child class of that c++ actor. -Go to the persona editor, and add a child actor component as a child of the inherited skeletal mesh. -Now try to attach the child actor component to body bone via parent socket, you will not be able to write anything inside, neither to find a bone.

Im sorry about muddling you xD

avatar image Matt.Williams Jun 09 '15 at 07:38 PM

One of our C++ guys and I attempted to repro this, and while we can't type in the Parent Socket field(you're not supposed to be able to type in it), we could still select a bone using the spyglass icon next to the text field.

As of right now, the only thing that might have been a bug would have been that "Child Actors attached to a parent with collision and physics enabled is automatically attached to the root bone". However I don't believe that is a bug. I'll bring it up with an engineer though.

-Matt W.

avatar image FrostSnake Jun 10 '15 at 05:59 AM

what did he do exactly? in my code, the tank body (skeletal mesh) AND the cannon (skeletal mesh) are inherited from c++, and the cannon is a child of the tank body.

I just looked at my blueprint, i also have a widget which is not inherited from c++, the socket works just fine (when you click the spyglass icon, a list of available bones will appear), but when you click on the spyglass of the cannon, no list appears.

(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