AttachActorToComponent problem

Hi

I have been using the AttachActorToComponent blueprint node for about a year now with no problems, but today I attempted to use it with the “in parent” input being a box collision component within a blueprint, and it caused scaling problems despite having Attach Location Type set to “Snap to Target, Keep world scale”, with socket set to None. And I have tried welded and not welded, with exactly the same result.

When I attached the actor to the component the first time while in game, it works fine, no problems, but when I detach the actor afterwards, the actor scales in the X and Z, but not the Y, since the box collision is scaled x=0.5, y=1, z=0.5
Then if I attach the actor again after this occurs, it scales yet again, and thus this repeats every time I attach or detach from a box collision.

Upon investigation, I don’t think it has anything to do with the type of object it is trying to attach to, but the scale of the “in parent” object.
It seems that the “keep to world scale” part isn’t doing it’s job, it is seemingly adding the scale of whatever it is being attached or detached to/from unless the scale of the parent object is 1,1,1.

So in the example I gave above, the object scale is 1,1,1.
I then attached to the target, it remained 1,1,1.
I detached from target, it changed to 1.5, 2, 1.5.
I attached to target, it changed to 2, 3, 2…and so on.

I don’t think it’s a huge important issue, but I hope this helps you guys :slight_smile:

Hello Otreum,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps to reproduce this issue in a clean project on our end?
  3. Could you provide screen shots of any blueprints that may be involved in this issue?

Hi Rudy, sorry for the delayed response.

I attempted to recreate the same problem in a clean project but it didn’t fail.

This is what I tried.

  1. Create a collision box in level and scale it unevenly (0.25, 1, 5).
  2. Created a box with dynamic movement (didn’t seem to matter what movement)
  3. In level blueprint, attach actor to actor, snap to actor and retain world scale, followed by a delay which then detaches, another delay to re-attach and so on, so forth…the problem did not occur.

I then tried the same thing, only the collision box was a child component of the third person character, and the level used the attach to component node, rather than attach actor to actor.
The result was there was still no problem.

In my game, I have a parent blueprint called “Pickup” which has never had any issues before, in fact a lot of the child blueprints derived from the Pickup blueprint can attach to sockets and components without any issues, possibly because the sockets and child actor components they are attaching to, are 1,1,1 in scale.

For some reason, this particular blueprint just does this wierd scaling problem.

My temporary solution was to create 1,1,1 scaled arrows for the actor to attach to instead.

I am still searching for the reason why this particular blueprint has this bizarre scaling problem, and I’m confused as to why when initially attached, scale is ok, but any detaches and attaches afterwards mess things up.

I wish there was a simple way for me to just send blueprints your way, but there is a fair bit of complexity in my game, especially in how items are used and interacted with since it’s all very context based.

…Continue to next post…

To sum it up though, lets say hypothetically, the player wants to pick up a solar panel, and place it onto a slot where the solar panel should go, on a solar array.
When a player picks up a “pickup_solarpanel” actor, the player has a left item held variable and right item held variable, depending on which hand was used, the actor will assign itself to the relevant “left/right item held” variable.

The player left clicks (left hand) with solar panel in hand, and then left clicks on the solar array, which contains a whole bunch of box collisions at scale (x=0.25, y=1, z=0.25) used to detect a line trace from the player and work out which slot the player is attempting to interact with.
The solar array blueprint then gets the left item held from the player, casts it as the solar panel, it tells the player class to do a drop function, sets simulate physics of the solar panel to false then attempts to do an “attachtocomponent” with the solar panel as target, and collision box as “in parent” with socket name set to None, Attach location type set to “Snap to Target, keep world scale”, and weld set to true …or false (doesn’t seem to matter in this case).

The first time the panel is placed, it remains at it’s world scale, however when the player interacts with the solar panel to pick it up again (the parent “Pickup” blueprint determines if it’s attached to something or not and works out if it needs to be detached from parent or not), it scales up.

Then I try to place it on the solar panel again, and it scales up again, and repeats the process.

It is as if the first time it attaches, it retains world scale, but afterwards, the Attach location type switches to “Snap to Target, Including Scale”.

Thank you for the information that you have provided. Would it be possible for you to provide the project that is having the issue? This can be done via drop box or google drive.

Sorry for the late reply.

Unfortunately, I don’t think it would be possible to send a part of the project, I would need to pretty much send the entire game.

For now, I have just put arrows components inside the solar array blueprint as the attachment points and they are scaled 1,1,1 so there are no issues with scaling upon attach or detach.

For now, that seems to be a decent work-around.

I apologize for submitting the report as a bug in UE4, as now I’m not so sure it is a bug with UE4.
I don’t wish to waste your time, so if you still wish to check it out, I’m happy to upload the project, otherwise, I’ll stick with the work-around measure for now.

Hello Otreum,

I am happy to hear that you have a way to workaround your issue. I will be converting your last comment to an answer. If this issue returns and you find that you can reproduce this issue in a clean project, please feel free to reopen this issue with any additional information you may have by adding a reply to this thread.

Make it a great day

I’m having this issue as well and it’s migrated from 4.18.3 to 4.19.2 with my project. As long as the mesh or object I’m attaching to is 1,1,1 then I don’t have any issues. If it’s scaled then I see the same behavior as above.