SetActorLocation not updating collisions for UInstancedStaticMeshComponent?

Hey everyone,

I am trying to teleport an actor containing only a scene (root component) and UInstancedStaticMeshComponent.

When using the SetActorLocation on this actor, the visible part is moved, but not the collision part.

To illustrate the problem, i used this scenario to obtain the following picture.

  • create a 3D map on the right
  • throw some dice on the map
  • move the map on the left with SetActorLocation(NewLocation)

Every part of the 3D map on the left is an instanced static mesh component.

As you can see, the map seems to have been moved, but the collisions remain on the right.

If i throw some new dice on the left, they go through the visible map like it’s not there.

So i am in the current situation:

  • new location: visible actor but no collisions
  • old location: invisible actor with collisions

It all happens on the server, so in principle it’s not a replication problem.

Any idea how i can fix that ?

Thanks

Cedric

I am having the same problem. Using Blueprint for me, but when I change the transforms of the parent component, the meshes move but the collisions of the original room remain the same. Thus the new room has no collision and the previous place has invisible walls. Bug??

Edit: This is exactly my problem. When applying a transformation in a constructor the collision doesn’t change, and this video is from April 2014.

Hey !

Little up, any idea anyone ?

Thanks

Cedric

Up Anyone ?

I had the same issue the one time I tried to use an instanced static mesh component, it wasn’t anything important so I just changed my approach in the end. I’d suggest reposting this in the Bug Reports section, it should get some more attention there.

Ok, anyone reading this, i did post a duplicate question in the bug section (not knowing how to change the section for this one^^):

Cheers

Cedric

uced, To get around this problem, I just moved the object to where I needed it, then spawned a new object there (with its collision) and deleted the old one with the wrong collision. I do this EVERY TIME I need to move it. It’s a crap solution but with no response from Epic, that’s all I’ve got. There is a bug report on this exact problem from like year ago (see my previous post) and it seems like they haven’t done anything.

Hey HuntaKiller,

Yeah, this is what i do too, but my objects are quite heavy to respawn (this is why i use instanced meshes, i guess you too), thanks anyway for the tip, as you said, better than nothing.

They just closed the duplicate i opened in the bug section because it’s a duplicate^^

Gareth Martin has confirmed that this bug has been reported, but unfortunately has not been fixed in 4.8. He says the bug has been marked as high priority and should be fixed in 4.9. For now just use the workaround.

All right, thank you very much for the info.

I can confirm this bug is still present in 4.9.2, and is occurring with regular static mesh components as well, not just instanced meshes.For such a serious bug I’m surprised it’s still around. Is it addressed in V 10 or 11? Oh. As of Dec /15 it is still not addressed Here

Silly question but is the UInstancedStaticMeshComponent set to movable? I ran into an issue like this building my instanced tile system when some of the stuff I was generating in my tile was set to static or stationary.

Hey,

Yes, still present in 4.10, i have opened a new issue that has been confirmed:

Cheers

Cedric

Workaround I found: set collision to none in the class settings then enable it when I need.

Will test that tonight

I had a problem similar to this when rotating a hism. The collisions would not update. Similar to what Yun-Kun suggested I did a work around where after each adjustment I would set collision to no collision and right after set it to physics and query. Fixed the issue for me.

I tried your solution but when setting to No collision the object starts flying all over the place. How did you set it exactly?

SetCollisionEnabled(ECollisionEnabled::NoCollision)

I’m with 4.14 and this still happens.

If you’re doing this on a physical object, it messes up its velocity and gravity settings I believe. I believe your workaround would be to switch collision response from “Physic Only” to “Both” instead of “Both” to “None” like I suggested.

Not worked had no effect. I applied to an “UStaticMeshComponent” object after moving it and some StaticMeshes attached to it.

MoveComponents()
SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);

But nothing happened.
I was seraching for a way to set it in each of the moved child components individualy, but they are “USceneComponent” which as fas as I know doesnt have a “SetCollisionEnabled”. Does a casting needed?

auto ChildCompPrimitive = Cast(ChildComp);
ChildCompPrimitive->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
ChildCompPrimitive->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);

Nothing happend either.

Also did:

auto ChildCompPrimitive = Cast(ChildComp);
ChildCompPrimitive->SetCollisionEnabled(ECollisionEnabled::NoCollision);
ChildCompPrimitive->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);

But it just Made some wierd movements.

AnyIdea?

Ok after some tests this is what it worked for me:

  1. Because it was a chain of statichmeshes with PhysicsActor Collision profile in mycase, but only some of them were moved, I wrongly changed only the moving ones. You have to set All of them.

  2. I created an “UpdateCollisionsFunction” that runs each time something is moved.

  3. Inside of this function you can find this:

ChangeCollisionType(ECollisionEnabled::NoCollision);
ChangeCollisionType(ECollisionEnabled::QueryAndPhysics);

  1. Inside this ChangeCollisionType(), I go through all the StaticMeshes and execute:

USceneComponent* ChildComp = thecomponentofeachStaticMeshInMyCharacter;

auto ChildCompPrimitive =Cast(ChildComp);
ChildCompPrimitive->SetCollisionEnabled(CollisionNewType);

This did the trick. Hope this helps.