[SOLVED] Potential bug found : rigidbody.raycastFirst return a result on disabled colliders

Hi,

It might not be a bug, but I have found that rigidbody.raycastFirst will return a collision with an entity attached with a disabled collision component. Is this supposed to be the expected behaviour?

Steps to reproduce :
1- Use a default PlayCanvas scene
2- Attached a collision component on the cube and then disable the component.
3- Attach this script to the camera :


4- launch the build, and it will log a raycasting result on a disabled collision component.

It might be expected behaviour, but it is annoying when managing 3D UI based on raycasting through obstacles (occlusion) .

Thanks,

Tristan

Just tried it with a test project and seems to work fine in my case. Can you share the project?

https://playcanvas.com/editor/scene/771015 (press space to disable/enable the floor).

I cant modify your project, but this is only happening if the entity is enabled, but the collision component is disabled. (and not the other way around), because when disabling the entity, it will disable the collision component by default.
image
Try using this.floorEntity.collision.enabled instead, and let me know if you have can spawn cubes in both states. This might be an issue on my side, but I have been able to reproduce this error in an empty scene.

Thank you for your time addressing this issue. It is minor, but can be annoying in a large project with a lot of entities.

Changed it: https://playcanvas.com/editor/scene/771015

Still works fine for me.

Can you share the project that this issue is coming up please?

Also tried with a brand new project with the same code, no problem here either:

https://playcanvas.com/editor/scene/771047

Ok, the bug has disappared from my project out of nowhere, but I don’t have the issue anymore. tried on a blank project like you did and the bug did not occured. Sorry for taking of your time, I tought it was an issue. It’s weird, but i guess some time by refreshing the cache or the project, it fixes those kind of issues.

Changed the title to fixed.

Thanks,

Tristan