Download

Failing to cast to BPs & can't figure out why, please help

I am trying to implement Interact Sandbox into my project because of its precision with grabbing & moving items around.
I have tried another kit besides Interact Sandbox and actually got that one to work BUT its precision is so horrible that it’s not worth using & it only seems to work with select items which won’t be useful for my purposes.

Ok back to talking about Interact Sandbox. The Interact Sandbox kit works fine on its own, but the problems begin after being added to my project. You can find the kit here if you need a reference: https://www.unrealengine.com/marketp…teract-sandbox
I’m also using the “Survival Game Kit” I should note that in case anyone is aware of some type of interference between both kits. It may be that I need some specific work around for Survival Game Kit, but unfortunately the authors of some of these kits are not very helpful, and to make matters worse I’m not an expert at blueprints yet.

The kit has multiple pieces & I’ve implemented all of them, however I can’t get anything to work, only a few of the events are firing based on what print string is showing me.
One of the problem areas (it seems) is this Action Hit Actor Type, as its successfully printing “hit actor type” & “Middle” but then it fails to cast to BP_IS_MasterItem and starts printing the “3”, and does not cast to BP_MasterInteract either so it does not print “2”.
I have print string through the entire BP_IS_MasterItem, and none of them are successful so its failing to cast to it completely for some reason.
I should note that other than putting in the print strings in the BP_IS_MasterItem, I haven’t messed with it in anyway, nor have I messed with BP_MasterInteract, they should both be similar to how they came, and neither of them have any code that I need to change.
I’ve noticed wherever I try to cast to those two BPs, they also fail, I can’t figure out what’s going on. Again they cast just fine when I don’t implement it into my project.

I’ve spoken to the person who makes the kit and they’ve tried to assist me but we’re still not able to figure it out. If anyone has any advice/ideas I’d be very grateful, I’ve spent many days on this already. Thank you

Going out on a limb and saying bp_is_masteritem probably needs to be what your objects class inherits from.

Drag out of that Hit Actor and see exactly what it is you’re hitting. That should help you debug.

Could you elaborate a little more for me on what you mean? The object is what in this example? etc Thanks :slight_smile: Yes I am that new to blueprints.

Thank you I didn’t know you could do that!
It says I’m hitting the survival character, which I don’t think is supposed to be happening, even when I’m looking at one of the items you are supposed to be able to interact with, .I wonder why that is?

Could you show us where you’re setting that Hit Actor variable?
If your Survival Character is the one starting the hit, perhaps the first thing it hits is Self, which you need to ignore.

Yes I believe this is the issue, it is hitting the character, but I can’t figure out how to “ignore” it.
I’ve tried following more than one tutorial on how to do it & none of them worked, possibly because they were outdated. One of them had me setting stuff in the character to not block visibility etc, and another had me add the character to actors to ignore. Oddly enough I’ve even tried moving the camera just to see if that would change anything, but somehow I still ended up hitting the player character.
I’ll provide a screenshot with more information.

Here is where the hit actor is being set I believe.

Here is the line trace function in the player controller:

Right. To ignore Self, you should add it to the Actors to Ignore.

From my experience, that Ignore Self bool does not actually ignore the Actor that you LineTrace from. (Maybe one day I’ll figure out what it’s for.)

Another thing I would like to note is that LineTrace stops at the first object it hits that is part of the Object Types you have as input.

You might want to create a new Object Type specifically for the objects you want to hit (Items, I believe?) and then change the respective actors’ Object Types to that new type, unless you’re sure that other objects won’t end up between the point you’re tracing from and the point you trace to.

I’ve implemented it as you’ve showed me to, and it’s still hitting my character. I’ll try to see if I can figure out how to do that object types thing.

I don’t see “items” in the list in the array, how do you add it there?

Sorry, I messed up and gave you wrong info, I just re-read what you posted and deleted my comment.

So, yeah, basically, from what I see your implementation is correct. It should ignore itself.
However you said you have the code in the Controller, which is not your character.

Instead of adding Self to the array, you actually need to GetControlledPawn and add that to Actors to Ignore.

You can visit these two links for info on how collision and object channels work in Unreal and how to add more.
https://www.unrealengine.com/en-US/b…sion-filtering

https://docs.unrealengine.com/en-us/…mCollisionType

I just added controlledpawn and now I’m no longer hitting my character, however I don’t seem to be hitting anything at all now for some reason…

You can enable the Draw Debug Type and set it to Persistent to have the LineTrace visualise in the world. That should give you a better idea of where it’s going and what it’s supposed to be touching.

If the LineTrace isn’t reaching your object, then you need to change its length or start/end points. If it is going through your object, but not registering it, you need to change the data in the Object Types array.

I set it to persistent but nothing is happening, I don’t see any lines. Do you have any idea whats going wrong with it?

I tested getting the traceline to fire on a different node, it fires & shows the lines with it, but still refuses to cast to BP_IS_MasterItem.