So for example we can get a cube entity with a collision and find it by name and add a filter to it, is it possible to do the same with a cubes individual sides/faces too? Is there an identifier or array that stores each side of the cube?
Is an example like this possibe?
The reason I want to find this is because I want to filter some sides of the cube from being detected by a raycast.
I think that’s not possible with the physics based raycaster. You could potentially get the contact point, iterate through the model’s vertices/triangles and find which face it corresponds to.
Another way would be to write your own mesh raycaster that consumes the raw geometry of the mesh, and doesn’t require physics. There is a feature request about this in the engine repo too.
This is specific for a cube, you could also use the local axis and positon of the cube and the hit position to work out with side of the cube was hit.
I’m currently thinking it be easiest to use the transform of the cube entity (without scale) and using to transform the hit position in local space.
Sorry I am not understanding this properly. I have made a raycast hit from all 4 sides of the cube but can not find the side which was hit.
Example raycast hit on 1 side:
Cube entity local position after raycast hit:
Can you explain this more simple for me please I got the local transform of the entity like above but how do I transform the hit position? do I need to convert the hit position to local transform? also what do you mean (without scale) I am confused by this sorry
On second thought, you could instead use the hit normal (assuming you are using physics) and the local up/right/forward axis with dot product to work out which side you have hit.
Example project: https://playcanvas.com/editor/scene/1421420
It console prints the face that is clicked on