Detect and react if player is close to an entity

You can put a trigger collider around the entities that interest you (the entities you want to be notified that your character is close to). If these entities are not supposed to move, then you can make them static colliders. (Make them a static collider by assigning physics material component and a geometry component such as box geometry, sphere, geometry, etc.) Then when your character controller enters a trigger collider the enter_trigger event will be emitted.

You can listen to this event in your client side JS code:

Client side JS Code

https://docs.3dverse.com/sdk/SDK3DVerse.engineAPI.html#onEnterTrigger

https://docs.3dverse.com/sdk/SDK3DVerse.engineAPI.html#onExitTrigger

SDK3DVerse.engineAPI.onEnterTrigger((entity, triggerEntity) =>
{
    console.log(entity, " entered trigger of ", triggerEntity);
});

Script

Right click, use the physics.events node, and make sure Listen Event is toggled. This event will be fired only on the entity with the trigger collider.

For more detailed info on physics bodies and triggers check our physics documentation: Documentation