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"

Blueprint Interfaces How To not working

EDIT: answer is in the last few comments of the accepted answer Hi, Ive been going through Blueprint interfaces figuring out how to use them. I can use them ater following this how to. The problem is its not working. As in the example they used which is destroying glass and changing the colour of a light is not working. I've looked through some other stuff about destructibles but I think that the how to doc would be enough to get the example working. The blueprints are the same. Thanks for your help

Product Version: UE 4.12
Tags:
more ▼

asked Jul 30 '16 at 05:09 AM in Blueprint Scripting

avatar image

ahuss
84 7 10 13

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

1 answer: sort voted first

Hello, ahauss,

Can you describe exactly what isn't working or what step is failing? I followed those steps in 4.12 and it worked perfectly.

Some things that might be going wrong:

  1. Make sure that you hit "compile" after you add the interface to your class defaults on any blueprint. Otherwise, the interface events won't show in your node list. The documentation is missing that piece of information, but it is always needed.

  2. If you did add the interface to the class settings and did hit compile but you are not seeing the "IsDestructible?" event (the node that it creates is red), and are only seeing the message or function versions of that (the nodes that they create are blue and/or have an envelope icon on the corner), then you are on the construction script of your blueprint. You need to be on the event graph of your blueprint for the event to show. Events only make sense in the context of the event graph.

  3. Make sure that the "projectile" actor, or any actor that you are using in its place, have "simulate physics" ticked (on the physics tab) and "simulation generates hit events" ticked (on the collision tab). Otherwise, when your projectile object collides, it won't fire the "on hit" event, so the interface message won't be sent.

If you select the actor but don't see the physics or collision tab, go to the component list on the details pane and select the mesh component of that actor (you will identify it by a small house icon). There you will see the physics and collision tab.

Now, if you are only interested in making a destructible object work, none of this is necessary. That tutorial is designed as an example of interface messaging, which is a form of blueprint communications. That is just an example of an interface working, but destructible meshes work "out of the box".

Just put the destructible asset directly in the level, no need to turn it into a blueprint (in the tutorial, that would be "SM_GlassWindow_DM"). Now, double click on your destructible asset to open the destructibles editor again, and then tick "enable impact damage" and set the impact damage to 100. Save.

Now, when any phisics object collides whit your glass window, it will add some damage to it; when the damage reaches 100, it will break. In this case, any collision will generate the 100 damage.

Note that the destructible does not need to have physics enabled, nor does the projectile need to have "generates hit events" enabled, because now you are not talking about a hit event, but about a damage generated by a collision event (all that is handled by the damage system built into unreal). If you do enable physics on the window, it will fall into the ground at which point it will break.

On the other hand, if you are interested in the actual interface functionality and in blueprints communications in general, this is the most in-depth information you will find:

https://www.youtube.com/watch?v=EM_HYqQdToE

Here is another video doing a step by step tutorial on destructibles (no blueprint interface involved):

https://www.youtube.com/watch?v=QIvcTwlosMQ

All the best.

more ▼

answered Jul 30 '16 at 08:41 AM

avatar image

Diego_Visualma
596 13 10 34

avatar image ahuss Jul 30 '16 at 09:52 AM

Hi Diego_Visualma, I followed your advice and checked 1,2,3. all were fine except 3, so i checked the boxes you mentioned. it still didnt work. I then did the destructible part where you told me to click on the mesh and enable impact damage. That still doesnt work for when I shoot the assets. However I did some searches and found other information and tried that with one of the glass panes. It was from the troubleshooting destructible meshes. I changed a few properties like collision type: overlap. This is the link. This and the changes I made with your post make 1 glass pane fracture and fall. With fracturing happening first. I havent shot it. I also made changes to it in the details panel in its destructible component to change collision type to custom and overlap.
I believe it is the blueprint interfacing that isnt working. But it may still be the destructible side as changing that worked for one. Also I made changes to another glass pane but that one doesnt fall. My projectile doesnt do anything to it, but shooting one of the cubes in the firstpersonexample map destroys the glass. Any Ideas?

avatar image ahuss Jul 30 '16 at 09:55 AM

Also just checked and the enable damage input is definitely the cause of the second glass pane being destroyed when colliding with a cube Still havent found the cause of one glass pane falling on start

avatar image Diego_Visualma Jul 30 '16 at 10:29 AM

Ok, by the sound of it looks like it is the part of the destructible or the collision that isn't working.

In the case of the glass pane that isn't working: Does your projectile hit the pane and bounces back, or does it go through? If it bounces, does it do it exactly where the pane is, or before hitting the pane? Are you using the same FirstPersonProjectile as the tutorial or a class of your own?

It might be that you have some other imported mesh that has an automatically generated collision mesh so big that your glass panes are inside it. You should enable show collisions on your viewport (alt+c) to check if your panes are already overlaping with something on begin play. If you find that, then select the offending mesh and turn off collision on it for testing purposes.

If that were the problem, then your bullets would never be hitting the panes because they would hit the other object first, and also your working glass pane would break on play because it is already overlapping and taking damage. On the other hand, it would lend to some erratic behaviour on the physic objects, like chunks flying around really fast and your character not being able to move near the panes. So you would probably notice it.

If that isn't the problem and your panes are not overlapping with anything on play: For the pane that is working, please check if "simulates physics" is turned off, and if it is also try it with physics on and start awake off (on the physics tab) and then report back.

Also, as a different test, import a sphere into your level, put it above your glass, and enable physics and generate hit events on it. When you play, it should fall and hit your panes. Try dropping it on each pane to see if the problem happens with any actor or only the projectiles.

avatar image Diego_Visualma Jul 30 '16 at 10:32 AM

Also make sure that both the projectile and the panes have "generate overlap events" ticked in the collision tab, they should by default.

avatar image ahuss Jul 30 '16 at 04:30 PM

Hi It sort of goes right through the glass pane that breaks on start and one other, that is a blueprint version of the asset. A third glass which would be with the exact default settings as in the how tutorial linked previously blocks it and bounces of it. It actually also goes through the wall in the example map in one place and at others it just bounces off. Then at some places it bounces of it momentarily dissapears before bouncing off making me think the collision is behind it. I did set the collision of my projectile to overlap Im going to change that back. I have changed collisions of glass and projectile back to block, one as destructible other as projectile. I get an error that displays after exiting play

Warning Invalid Simulate Options: Body (FirstPersonProjectile_C_3.CollisionComponent) is set to simulate physics but Collision Enabled is incompatible. This ONLY happens with the projectile.

The meshes I used are starter content. so no auto generated collisions. I checked simulate phyiscs. They were off, turned them on and also put the sphere in. the sphere broke all glass panes. I believe it is all a problem with the collision Specifically the projectile collision, but I cant figure out what. Its all default

It seems the projectile just wont collide with the glass while everthing else does and destroys the glass. Also just ran into it. Didnt occur to me to do that before, dont know why but it broke the glass too. So its DEFINETELY the projectile

avatar image ahuss Jul 30 '16 at 04:42 PM

Also checked the collisions. They're all there. The one that was breaking on start was colliding with a box. I placed a projectile in the glass and it broke. So it seems something to do with the projectile that is spawned by the gun.

avatar image Diego_Visualma Jul 31 '16 at 11:26 PM

I checked a clean First Person Blueprints project to see the properties of the projectile, and I have found that your problem is on the interface side and that I gave you inaccurate information on the changes needed to the projectile. The destructible part is ok, you have set it right.

The projectile blueprints is not a physics object. It doesn't need to have physics enabled, it's movement is coming from a "projectile movement component" inside the blueprint, and that accounts for everything including the bounces. Please turn off the simulate physics checkbox on the components of the projectile where you might have changed it.

Also, when any object blocks your projectile, the "Event Hit" node will fire. It doesn't need to simulate physics for that. You can test this plugging a print node directly to the event hit on the event graph of the projectile. You will see that your message prints when you hit anything, including your glass pane that won't break.

Now, what is the projectile blueprint doing on the clean original project? You get an event hit, giving you the component you hit. First, it is checking with a branch if the hit component is simulating physics. If it isn't, it does nothing. The projectile component has a should bounce checkbox enabled that will make the projectile bounce.

So every time your projectile hits the walls or floor, it will bounce off them, not because of physics, but because of the projectile movement component. Also, your glass panes are not simulating physics. So your projectile will bounce off them just like it bounces from the floor. And it will not add impact damage (there is no impact).

What happens when the component we hit is simulating physics? Then, it is using an "Add Impulse at Location" node to manually add a physics force to the hit object. Even though we don't have physics on our projectile, we can manually generate forces and make them affect components that do have physics.

[1]: /storage/temp/100891-blueprint9.jpg

blueprint9.jpg (104.3 kB)
avatar image Diego_Visualma Jul 31 '16 at 11:28 PM

And lastly, the projectile self-destroys. When you are seeing your projectiles go through some parts of the levels or through the boxes, they are not doing so. They are disappearing. The projectile actor is destroying itself, so it ceases to exist in the level.

Here is how the original blueprint looks like.

alt text

So, your projectile is not designed to generate impact damage and is not a physics object. So it won't affect your destructibles like other objects would, and the solution is to implement that effect manually, meaning manually adding the damage to the destructible when it is hit by the projectile (just like we are manually adding a force when an object we hit is simulating physics).

What are the changes to the projectile blueprint doing when we follow your tutorial?

Originally, you did nothing if the object you hit didn't have physics enabled. Now you are sending the actor that owns the hit component an interface message.

Interface messages can be send to any actor that you get a reference to. When they receive them, they will run some code that you implemented as a result. The nice things about interfaces is that you can send the message to any object, and if they don't have the interface implemented (added to their class defaults, and then used within your blueprints to get the result you want) they won't do anything but that will also not break or crash your game.

So, if we follow your tutorial, every time we hit the floor or walls, we see that they are not simulating physics, so we send them an interface message. They don't have the interface implemented, so nothing happens.

If we hit the blueprint that has your destructible as a component, something will happen, because that blueprint has the interface added to it's class component (so the communications channel is set and ready) and also has some code to do when the message is received.

blueprint9.jpg (104.3 kB)
avatar image Diego_Visualma Jul 31 '16 at 11:34 PM

Note: The interface message does nothing except pass some information from one blueprint to another, either as an event or a function firing on the receiver. You interface message is not applying damage, or checking if the object is destructible for that matter. It gets the information to your glass pane blueprint actor, and that actor in turn is the one responsible to deciding what to do with the info.

Your glass pane blueprint will have an event that fires every time the message is received, and that will use an apply damage node to affect the glass pane commponent (which is the actual destructible).

So... The problem is on the interface side. I hope this explanation makes clearer what is happening.

Make sure your interface is implemented. Specially, make sure that the event "Is destructible" is firing on the glass pane blueprint every time you hit it, independent of it breaking or not. Test this whit a print node. That will help us make sure that the interface message is being received, and the problem you have is just the implementation (in this case applying damage to the component).

If that event isn't firing, then we have a problem with the message. Either the interface isn't in the class defaults of your glass pane, or the message it isn't being sent, or it is being sent to a different actor.

In the case of the last two: Make sure that in your projectile blueprint, the target of the "Is Destructible?" message is not the output of the "Other Comp" of your Hit Event, but the output of "Other".

"Other" gives you the actor that you hit. "Other comp" gives you the component. We use other comp to check for physics because it is those who simulate physics or not. But we want to send the message to the actor, because it is the one that has the functionality and the interface implementation.

avatar image ahuss Aug 01 '16 at 07:27 PM

Hi Its finally working. I removed physics and then changed the graph. It sutrns out i was using other component not other. However, when you said the projectile was destryoing it self, it wasnt. it was going through the walls when I had simulate physics on,possibly because the projectile particle would not bounce with physics on. I checked the P.I.E and the actors count. So it turns out that collisions generate hit events, but does physics also. What i dont understand is that when the projectiles were going through, they would be destroyed some time later. How that hapens i dont know as the true branch of the standard blueprint is the only one that has destroy actor and that is only if it is hit. Thanks for your help diego_visualma. It works.

(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