Was wondering how exactly the raycast collider works. I'm assuming it just detects collisions in the direction it faces? But as i'm applying it i'm not seeing any way of changing it's direction (which appears to be down), meaning it will only detect collisions underneath the object?
How have people been using this? Would I need to create a child object and rotate that to point the collider in the direction that i want to detect? And would I need to add multiple child objects to detect multiple directions? Thanks. -d
You need to create a child object and rotate it to make it face in different directions.
What do you want to use the raycast collider for?
well, we have some rats that are initally animated on a path. Once one gets bitten by a snake (the player), it needs to run away and eventually die.
But i've been having the hardest time moving them around while keeping them from going thru other objects in the way. I've tried using rigid bodies w colliders and the character controller with varying wierd (as in not successful) results - e.g. falling thru the floor, flying off into space, or just not doing anything...).
Finally - since time is short, and i'm really not so experienced in the world of 3d - we settled on moving the bitten rat by playing another path animation. But since animations seem to override or ignore any collision detection, i'm casting a ray forward from the rat and if it gets too close to any obstacle, it just stops playing the animation.
So I was wondering if the raycast collider could have been another option here? I hadn't actually noticed it before and it's not really mentioned in the docs... What is the best situation to use the raycast collider?
Usually it is used for hover crafts or vehicles. What you want to use is most likely a box collider trigger.
If your colliders are falling through the floor the easiest way to solve that is to up the fixed frame rate in the Time settings Edit -> Project Settings -> Time. Also you can try making your whole game assets on a larger scale. Eg. make the snake 2 meters big.
For a snake i would use a Capsule Collider with a Rigidbody.