This is just one of those things that you’d expect to work relatively straight-forward. I have done this previously without issues in earlier versions of Unreal Engine, however I am stumped here on how a public global variable is outside of scope.
I’m trying to get dismemberment/gibbing working in Unreal. I have the FPS starter kit open, and inside the projectile blueprint I am splitting the hit result to obtain the ‘hit bone name’ and assigning it to a public editable ‘name’ variable. I want to access this inside the Actor Blueprint of a character with a skeletal mesh, so I can use a Break Constraint using the aforementioned variable – however, it says the name variable is outside of scope when I try to cross blueprints. I cannot figure out or find answers as to why crossing variables is not working.
Does anyone have any ideas what is restricting the variable?
Are you trying to drag&drop one variable over different blueprints? Of course this isn’t working, how could your Ninja_Blueprint ever know which projectiles’s BoneHit variable he should take? You need to have a reference to the respective projectile in the Ninja_Blueprint and then take its BoneHit variable.
Inside your EventHit event, you want to cast Other to Ninja_Blueprint and for example then call an event inside your Ninja_Blueprint that tells the Ninja_Blueprint what bone got hit. You need to create that event inside your Ninja_Blueprint on your own.
Edit: Btw, the editable attribute of your variable doesn’t have anything to do with this. I doubt you need the BoneHit variable to be editable.
That makes sense Pepe, and creating a cast was the first thing I tried before posting. I am however a bit confused as to this error stating that the “Ninja_Blueprint does not inherit from Primitive Component”
Please plug “Other” in the cast, not “OtherComp”.
Now you only need to make the InBoneName of BreakConstraint an input variable of BoneWasHit. You can then plug the HitBoneName within your projectile blueprint directly in the BoneWasHit event call.
Pepe! Thank you so much for your help.
As a side note, you must set your collision settings on the projectile to ignore the category of the collision capsule surrounding your character, and vice versa, the character’s capsule must ignore the projectile’s category. Thirdly, Character’s Mesh must also have collision enabled, and it’s category must not intersect with the projectile or capsule!