Dynamically spawned actors collide with themselves, I wish they didn't
I have a level blueprint that is randomly spawning 4 blueprint actors in my level, with random velocities. I need those actors to have active collision (so I can shoot them up) but I want them to ignore collision with just each other. I can't quite figure out how to exclude them from hitting each other, since I spawn them in the level blueprint instead of have them placed more implicitly in the level to begin with.
Basically I'm trying to make a simple asteroids clone, and my asteroids need to pass through each other, but still get shot up and hit the player.
asked Apr 11 '14 at 05:20 AM in Blueprint Scripting
$1.99 Taco Combo
Someone posted this answer, but it seemed to only be sent to me. So I thought I'd repost it here so other people can see it, it thoroughly answered the question. Thank you "cancel", mysterious answerer.
We're going to add custom collision for your asteroids. In the UE4 editor, go to Project Settings. Click on the 'Collision' page link on the left. You should see two main boxes on this page -- Object Channels, and Trace Channels. We're only worried about Object Channels today. Click the "New Object Channel..." button. Give it the name "Asteroid", and make its Default Response 'Block' (it should already be set that way, but just make sure). Click 'Accept', then click 'Set as Default' to save the changes. Close the Project Settings window.
Find the Asteroid Blueprint that you're spawning into the world. Open the Blueprint Editor for it, and switch to the Components tab. Now, I'm not sure what Components you have in your Asteroid Blueprint, but there is probably a mesh, and there might also be a Sphere or another primitive shape, depending on what you started with. If there is no primitive shape, that means UE4 is using the mesh for collision, which is what we want for this example.
If there is a primitive shape, that means either of them could be used for collision, which we probably don't want. Therefore, if there's a primitive shape component (Sphere, Capsule, Box, etc.), delete it from the components. If it's the root component, you'll first need to drag and drop the mesh component into its place before the editor lets you delete it.
Now, select the mesh component, and then scroll down in the Details palette until you see the Collision section. Find the 'Collision Presets' dropdown, and then select 'Custom...'. This is where we set how the custom Collision behavior for the Asteroids. First, we need to set its 'Object Type' to Asteroid, which means it will be placed into the Asteroid channel (that we we created earlier) when UE4 is calculating collisions. Now, under the 'Object Response' list, we get to choose how this Asteroid Blueprint will react to other object channels in the world. Probably the only want we want to change is the 'Asteroid' one: set it to Ignore!
Now, since your Asteroid Blueprint entities will all be placed into the Asteroid object collision channel, and since they are also set to ignore the Asteroid channel, they should all pass freely through each other in the game.
Hope that helps clear up custom collision for anyone else just getting started :)
answered Apr 23 '14 at 04:52 AM
$1.99 Taco Combo
Try setting Collision Preset to OverlapAll
answered Nov 10 '15 at 01:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here