Add Impulse inside Trigger volume not working

In the project we have a weapon throw system where we add impulse to the weapon from the hand to throw it. It works without problems through the whole game.

The problem is that when the player is INSIDE a Trigger Volume (for example to detect if the player is inside an area so an elevator moves) when the player throws the weapon, it doesn’t get the impulse and it just falls flat without any force.

When you stop the game, a warning occurs that says that Simulate Physics must be enabled in the object. The weapon HAS the Simulate Physics enabled, so I tried to enable them on the trigger just to test it. Now it throws the weapon perfectly inside the Trigger Volume, while if the trigger has Simulate Physics disabled it doesn’t work.

I think it is a bug because it is not a collision problem, it isn’t colliding with the trigger, is just not allowing to add an impulse to the object. It makes no sense that the physic properties of the trigger affects the item to throw.

Hello, Is there any chance you could provide a sample project or a list of steps to reproduce this. While I agree with you that this could very well be a bug I am going to need at least a list of reproduction steps. A small sample project show casing the bug would be best if available. This is so that I can make a clean and concise report to the dev team regarding this potential bug. Thank you.

I created a new project and tried to replicate it but I didn’t manage to do it. I’ll explain to you step by step what happens in my current project.

Our character can pick and drop weapons and items. When the character picks an object, the simulate physics is disabled. As soon as it is dropped, the physics are enabled and then if the player throws it, I execute this C++ code:

//I get the mesh of the weapon
UStaticMeshComponent* itemMesh = item->FindComponentByClass<UStaticMeshComponent>();

//I drop the weapon
PickDrop->Drop(hand);

itemMesh->SetCollisionResponseToChannel(ECC_Pawn, ECR_Ignore);
		
FVector MyLocation = item->GetActorLocation();
FVector TossVelocity;
UGameplayStatics::SuggestProjectileVelocity(this, TossVelocity, MyLocation, TargetLocation, ProjectileSpeed*3.f, false, 0.0f, 0.0f, ESuggestProjVelocityTraceOption::DoNotTrace, FCollisionResponseParams::DefaultResponseParam, TArray<AActor *>(), false)
			
		
itemMesh->AddImpulse(TossVelocity, NAME_None, true);
itemMesh->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);

projectile->UnregisterComponent();

So when I throw the object in normal conditions, it gets thrown to the target with no problem at all.

But if the character is inside a Box Trigger for example, the AddImpulse function doesn’t work, the weapon gets dropped but not thrown and I get a warning like this: “Enable Simulate Physics on the mesh to AddImpulse”. But the mesh DOES have the property enabled when it gets dropped. The strangest thing is that if you enable the Simulate Physics property for the trigger itself, then it works again.

I’m so sorry I couldn’t reproduce it in a separate project, it could be our mistake in some line of code or some property that makes this happen, but the item having the property, and the property of the trigger affecting the AddImpulse of the object makes me think it could be a bug.

Thanks again and ask for anything I can do to help clarify this.

I’ve got something I would like you to try when you get the chance. If you take your project where your issue is prevalent and just create a new blank box trigger with no settings applied to it. If you then go inside this blank box trigger and try throwing a weapon does that generate this issue? Once you have tested this please let me know the results. After that I will have a better idea of how to proceed with this. Thanks.

Ok that is good to know. At this point If you could provide the code relating to your weapon throw hopefully that could shed some light. Any other code that could be potentially related as well will also be helpful. One other thing I am curious about is have you tried making a copy of your project and upgrading it to 4.17 or 4.18 on the off chance that it is fixed in a newer version?

Yes, it generates the issue. I tried with a box trigger, a sphere trigger, a capsule trigger and a trigger volume and it doesn’t work from inside of any of those. Everything directly placed, just blank volumes with no settings changed.

Another thing I’ve noticed testing is that enabling the Simulate Physics of the trigger doesn’t make it work, is just that the trigger now has physics and falls down… So sorry for the confusion, didn’t think about the trigger falling down at all.

I tried in the 4.18 and is still not working. We have two handed weapons and one handed. Right now I discovered that the two handed weapons work just fine, I can throw them with no issue, the problem is with the one-handed weapons, so it’s probably our fault somewhere.

I’ll keep looking into it because as I investigate a bit more, the more certain I am that is not an Unreal bug and is our problem. I’ll look into it with my co-workers for a bit more and I’ll keep you updated so I don’t waste more of your time.

Thank you so much Jeff for your time and help. I’ll keep you posted if we find a solution in the next days.

Alright that sounds good to me. For now I will mark this as solved but if you do find an issue down the road that you feel to be on the engines side feel free to reply and reopen. Best of luck with your project.