I know its complicated to raycast skinned meshes, at least what i heard from unsuccessful experiments.
But what i would like to do is just being able to check if a ray hits a certain material, or face and return 0 or 1.
It does not have to be a specific face, cause i want the whole model as 0 or 1, which could simplify it?
Is this possible with skinned meshes? and how then?
My low skilled solution would be to render them twice and ID the skinned objects by RGB colors, and raycast pixels…?
Thanks
im not shore if you can do it or not in unity. you mite be able to do it with a Two Pass Shader and a Transparent map OR Alfa Cut off Map
If it’s the entire model you’re casting against, you could try just adding some colliders to the bones and use it like a traditional hitbox setup?
Unless it’s important that you have it per-poly accurate?
That was the issue. In my opinion its too inaccurate to use colliders in this case… but i may have to use the traditional way.
You face a couple of problems here. Especially if you are talking about a rigidbody object. You would need to have a hyper accurate account of face to collider information. This means that you would have to know what the collider was, which face it hit on and then have a detail of what those faces mean to the engine.
I haven’t seen anything that tells what face that a raycast hit. I am sure it is possible to get it, but I am sure at this point it would be pretty memory intensive.
If we are talking terrain, or static objects, that is very simply, abandon the per face hit, and change it to single objects. So all faces in Object A are concrete, all in Object B are grass. This way you simply tag the objects what they are and it gives you the feedback you need.
hmm… ye
I don’t really need to know what face i hit, but what object. In this case - a skinned object without colliders. A character to be specific.
I’m wondering if it’s worth all the time spent, or if i should go back to traditional simple hitboxes.
Anyway thanks for the feedback
If you are specifically looking for if someone was hit in the arm or whatever. Hit boxes are the way to go. Just align them and parent them to the joints and you should get everything you need.