x

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"

Bouncing projectiles have no collision

My projectiles ignore walls and floors (both BSP and meshes) but I want them to collide with those so that they can bounce off of them.

Some things I tried (may differ from screenshots):

  • Simulate physics: unchecked

  • Generate overlap/hit events: checked (this should not be required though but just in case)

  • Tried with BSP and Mesh.

  • Checking "simulate physics" will cause the projectiles to fall flat to the floor, but it does NOT go through the floor. It actually collides with the floor but this behavior is obviously not very useful for a projectile.

  • I made the Mesh a child of the collision component (should not be required but some people say it is).

  • I tried using a custom Projectile "Profile Preset" and "Object Type" but didn't work either (same result obviously).

  • There is no code in the blueprint that affects collision. Only an event that implements the OnComponentBeginOverlap.

  • Tried various collision presets but none worked.

  • Projectiles DO COLLIDE with enemies and players and also generate OnOverlapEvents. Just not with BSP and static meshes.

  • I checked the default starter FPS Projectile but couldn't find any difference with my projectile.

  • I tried setting the CollisionSphere to "BlockAll", I checked the "Block All" collision profile and made sure it actually does block everything. Still does not work

  • I rebuild the level

  • Added more collision boxes and spheres to this projectile and set them to "Block All".

  • I am out of ideas...

My settings (click links at bottom of post to enlarge): alt text

I created a quick custom mesh and added a HUGE floor collision box. But projectiles still go through it: alt text

Product Version: UE 4.11
Tags:
bp.png (350.5 kB)
bp2.png (517.3 kB)
more ▼

asked Apr 19 '16 at 03:40 PM in Blueprint Scripting

avatar image

Napoleonite
600 93 105 156

avatar image Napoleonite Apr 19 '16 at 04:59 PM

I also tried a new 'projectile':

  • Created new blueprint derived from Actor

  • Added a ProjectileMovement component

  • Set the initial ProjectileMovement speed to 100

  • Added a cube so I can see it in the world

  • Added a collisionbox and set it to "Block All" and check "generate hit events"

  • Drag the cube into hhe level in front of the playerspawn

I run the game and I see the cube falling through the level straight away...

alt text

bp3.png (357.2 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

I copied the "FirstPersonProjectile.uasset" from the FPS sample into my project and rebuild it into my new BaseProjectile. I still have absolutely no idea why that one works and mine doesn't since I can't find any difference between the two blueprints aside from having a SceneRoot component (which I can't even delete).

I would still like to know though what I and all those other people did wrong. Because not one of these posts I could find anywhere on Google had an actual answer other than some silly workaround. Meaning nobody knows?

Secondly: Why does unchecking "simulate physics" also prevent collision-checks including overlaps? Intended?

I found the problem! Might be a UE4 bug. Apparently the moment I ctrl+x the SphereComponent from the FirstPersonProjectile and paste it back (this creates a scene-root so the sphere collision component is no longer the root) breaks it entirely. Only applies to actors that have the "simulate physics everywhere unchecked". So the CollisionComponent MUST BE THE ROOT in the actor-blueprint and when not, ALL COLLISION (except collisions with pawns for some reason) is gonna be ignored by the game for this object. I reproduced it across several projects. If Scene_Root is the root (which is default) it will break.

Sadly you can't override the Scene_Root in a child-component... Man this whole thing is so weird I dunno why they implemented the Editor to work this way. So you gotta put in a dummy-component instead of the default-root, then replace it in the child in the constructor with the real thing. Only then can you replace it...

Note that adding additional collision-components does NOT work (only the root-collision-component works).

Because of this insanely weird behavior my guess is that this is a bug.

more ▼

answered Apr 19 '16 at 06:31 PM

avatar image

Napoleonite
600 93 105 156

avatar image mnVoh Apr 23 '16 at 04:43 PM

Yup, what you described after "I found the problem" was the only thing that worked for me too. I added a collision sphere, and dragged it over the scene_root, which replaced it and then it started working.

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

When actor have DefaultSceneRoot you need to "Set Updated Component" in ConstructionScript. By doing this "Projectile Movement Component" will update the "Collision Component" other than DefaultSceneRoot ,then Collision will work! alt text

more ▼

answered Aug 02 '16 at 10:55 AM

avatar image

xiaosi
21 1 2

avatar image Flash7 Oct 16 '17 at 10:33 PM

this solution actually works.

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

Try having simulate physics Off, change collision type to block all, and simulation generate hit Events on. In the enent graph, make a hit event that adds impulse at location

more ▼

answered Apr 19 '16 at 03:45 PM

avatar image

ViceVersa
1k 64 50 98

avatar image Napoleonite Apr 19 '16 at 04:25 PM

I did all that (for both the mesh and the SphereCollision). I also added the impuls (but it never fires). The onhit-event is never fired not even when the projectile is in the middle of a wall-collision. I may have coded the impulse wrong I think but nonetheless it doesn't even fire.

alt text

bp3.png (89.7 kB)
avatar image ViceVersa Apr 19 '16 at 04:37 PM

In the picture it says block all dynamix, change the collision sphere to Block All. And the mesh to no collision. The mesh is just there to look pretty.

avatar image Napoleonite Apr 19 '16 at 04:40 PM

Yes and I did as you wrote me (I changed it to block-all). Still doesn't work. I even added more collisionboxes and spheres and set them to block-all and checked "generate on hit events" but they go straight through everything except for other pawns... Which is weird. And generate no onhit-events which is also weird.

I'm getting this feeling that something somwhere is overriding something to make it only collide with pawns and with nothing else. But when I add a printstring to the "Get Collision Profile" it prints "BlockAll" during runtime so the profile is set correctly and not overriden anywhere. Still it only collides with pawns. So I checked the "Block All" profile but it is setup correctly (blocks all).

So basically I have a projectile (inherits from actor) with multiple collision-components that all are set to block-all and "generate hitevents" checked. And yet they go straight through meshes (with collision) and BSP w/o firing any onhit events nothing. How is this even possible?

Yes I hit compile+save after making any changes. Yes I did rebuild the level just in case.

avatar image Napoleonite Apr 19 '16 at 05:08 PM

Could it be that the ProjectileMovement component is making the projectile move regardless of collisions? But it still wouldn't explain why onhit and overlap events are not firing.

After some more Googling around for this "on simulate physics" checkbox (note that both questions did not get answers with a solution other than workarounds):

https://answers.unrealengine.com/questions/380255/simulate-physics-projectile.html

https://answers.unrealengine.com/questions/264833/collision-doesnt-work-without-enabling-simulate-ph.html

It seems that the moment you do not simulate physics, ALL forms collision detection will break/cease to exist other than pawns. Is this a bug?

I managed to somewhat get it to work by checking "simulate physics" and unchecking "enable gravity" but this MUST be performed on the MESH component. Which is silly because the collisionboxes themselves still do not work, only the mesh can. And the mesh is supposed to be a visual only normally.

I also took the FPS project (with a working bouncing ball) and copied it's mesh, projectilemovement and collisionsphere into a new actor-blueprint. So now I'm 100% sure I got it all setup right. Still it falls through the floor. So it's not the settings in the detail panels the difference has got to be somewhere else.

Also I noticed that the FPS project has no SceneRoot component in the projectile. But I can not delete mine. I assume that the default project was upgraded from an older UE4 version that allowed not having scene-roots.

(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