Hi, I’m having a problem with setting the collision response on a UStaticMeshComponent.
I have a video of the problem here and the code I’m using is:
void AWeapon_Button::Set_Mesh(UStaticMeshComponent * _incoming_mesh, UStaticMeshComponent * _outgoing_mesh)
{
_outgoing_mesh->SetWorldRotation(_incoming_mesh->GetComponentRotation());
_outgoing_mesh->SetWorldLocation(_incoming_mesh->GetComponentLocation());
_outgoing_mesh->StaticMesh = _incoming_mesh->StaticMesh;
FCollisionResponseContainer collision_response;
collision_response.SetAllChannels(ECollisionResponse::ECR_Block);
_outgoing_mesh->SetCollisionResponseToChannels(collision_response);
}
The problem I have is that after I set the collision response the object doesn’t react (to a line trace in this instance) as it should.
If I go into the editor and look at the objects collision values they have changed to block but the only way to have it actually by my line trace is to click on one of the checkboxes in the collision settings, I don’t actually need to change any values, the act of clicking on one of the checkboxes makes it work, when I go back into the game it works as it should.
So far I think it’s something that PretEditChange does but I don’t know what.