If I do a line trace for a custom object type, the result is always false, even though it should have hit. As soon as I change back object type and the line trace object type to pawn, the result is true.
Expected: custom object types should also return true if the trace hits, just like the trace reacts to default object types.
Go to project settings, add a new collision object type (for this example: player)
Add a pawn to the scene, change capsule component → collision → object type to “player”
Do a line trace from the camera to that object, with object type array added “player”
See that the result is false
Now change pawn object type back to “pawn”
Set line trace object type array also to “pawn” and do the line trace again
See that the line trace returns true.
I tested this in 4.8.3 the way you described, and it returns true when i hit the pawn with the line trace. I have a couple questions to help clarify what I might be doing differently than you:
- Are you using the LineTraceForObjects node?
- For the Object Types input, did you Promote to Variable and give it a single element of Player?
- Is the Default Response for the Player Object Channel set to Block?
- Does this happen in a new project as well, or only in your current project?
Is there any additional information to help reproduce this? Would you mind uploading your test project somewhere and getting me a download link?
Thanks for your response. Yes, default is set to block. Here is my setup:
Left: the line of sight check trace. Right: collision from player character capsule
Hm, I tried setting it up this way as well, in a BTService, but still don’t get false. Can you set this up in a new test project and upload that somewhere for me?
I haven’t heard back from you yet, so I’m resolving this for now. If you get the opportunity to build a small test project in which this same problem occurs, please upload it somewhere and get me a download link to check out. Thanks!
Do line traces check for any other thing besides this collision object type? What else could cause the line trace to fail even if it does hit the object?
The Line Trace for Object should return everything marked as the Objects assigned to it, minus the Actors assigned to Actors to Ignore. Unless the Actor you’re trying to find is in that Actors to Ignore list, the line trace should not be failing.
I can take a look if you want to send me your project via PM on the forums, or if you can reproduce this in a smaller test project.
I had this same issue with a sphere trace. Rebooting the client fixed it. I think something wasn’t saving with the project settings or something, not too sure. Fixed though…
I just wasted an hour of my time with this exact issue. Rebooting the client fixed it as well. Amazing. Thank you Cory.
For epic - The bug seems to happen when you:
Add a CapsuleTraceForObjects (example) to your BP, but you don’t have a custom channel type yet.
Go to project settings and add a new channel object type
Go back to BP you can’t select your new channel type yet. So Compile.
Now select the custom object type.
Restarting the client fixes it.
Hello. I have the same issue. What do you mean with restarting the client? I havent been able to solve it yet.
What do you mean with rebooting the client? I have the same issue and can’t seem to find a solution
Boy this is from 2018. But I just meant reboot unreal engine.
Thanks for the answer! Yeah, sorry… I had to ask, since I did restart unreal but it didnt fix my problem. I’ll do the project from scratch. Luckly I was just testing some mechanics for the project i’m planing. I’m still somewhat a beginner in unreal engine.