I’ve been trying to figure out why my ray cast wasn’t working, then I realized it worked fine with dynamic objects, but not with triggers. I couldn’t find anything about it in the docs or the forum so I wasn’t sure, is this a bug, or intended?
( . . . or am I going nuts and it’s an error with my code . . . )
Neither, it’s the ray_cast_response that I’m concerned with. It’s not a game-breaker, I can use a kinematic collider instead of a trigger and I get the expected response. I just didn’t want to report an omission in the docs if it’s actually an engine bug.
Triggers are similar to ray casts in that they are supposed to read the physics world as opposed to interacting with it. IIRC we did a custom implementation of triggers to slim them down as much as possible, this might be why ray casts don’t hit them. I can definitely see that this is confusing. I don’t have access to the code right now (easter vacation!) so I can’t say if this is a trivial fix or not. If you have very few things that the ray casts are supposed to hit, I would actually recommend you to duplicate collision objects for different purpose. I’m guessing your thing has a trigger to detect things in the vicinity, and then something should detect it throught the means of ray casts? Would it be plausible to give the thing one collision object for detection and one for being detected? It would create duplicated things to manage in terms of tweaking, but given there are few of these things the performance overhead would be insignificant. Sorry for the vague answer, I can give you a more precise one Tuesday when I’m back at work.
Ahh, OK, thanks for the info. It makes sense, and might actually be the desired behavior for some cases. I realize I was essentially using a trigger as a kinematic object, only I didn’t want other objects to collide with it, except for my projectile, which I’m handling with a ray cast. So, switching it to a kinematic object and using an extra collision group solved the problem. I can put in a request to add something about this to the ray cast documentation.
You could add this to the ray_cast documentation, because i had exactly the same issue as ross.grams. It took significantly longer till i found this forum entry than it would have taken reading it in the documentation what the current working mechanism is Thank you!