Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.16
more ▼

asked Nov 14 '17 at 12:09 PM in Bug Reports

avatar image

23 2 5

avatar image Jeff A ♦♦ STAFF Nov 14 '17 at 02:28 PM

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.

avatar image worm3d Nov 14 '17 at 03:38 PM

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
 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);

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.

avatar image Jeff A ♦♦ STAFF Nov 14 '17 at 05:35 PM

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.

avatar image worm3d Nov 14 '17 at 06:50 PM

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.

avatar image worm3d Nov 14 '17 at 07:01 PM

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.

avatar image Jeff A ♦♦ STAFF Nov 14 '17 at 07:21 PM

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?

avatar image worm3d Nov 14 '17 at 07:50 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Nov 14 '17 at 07:56 PM

avatar image

Jeff A ♦♦ STAFF
3.2k 2 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question