if physics is enabled, calling SetWorldLocation (either in C++ or blueprint) on a skeletal-mesh does not seem to do anything. This is strange, because with StaticMesh, this works fine.
on a skeletal mesh that had physics enabled, it DOES move to it’s new position… weird right? (but that leaves you with a skeletal mesh with simulate physics off, which is not what I want)
Somehow it seems that when you use SetWorldLocation on a skeletal mesh, it forgets to update the new location to the physics engine, and the physics engine moves it back to it’s old location.
I assume this is a bug? Could this be fixed please? And does anyone know a workaround?
I have reproduced your issue, and have entered a bug report (UE-27783). Thank you for your report. I will provide updates on this issue as they become available.
I’m currently experiencing almost the same exact issue with UStaticMeshComponent.
ItemMeshComponent->SetWorldLocation(NewLocation); // here is where I set the location
SetActorHiddenInGame(false);
SetActorEnableCollision(true);
DropItem();
void AItemBase::DropItem()
{
bIsCurrentlyHeld = false;
ItemMeshComponent->SetSimulatePhysics(true); // this line wont let the component move
OnItemDropped();
}
However, if I move the physics change inside the blueprint on my OnItemDropped() blueprint event with a 0.1 delay added it works. It’s like it needs a little bit of extra time in order to actually set the location of the staticmeshcomponent and when you set the physics in the code it just happens too fast.