I’m not entirely sure if the question makes sense with other people but in my mind I’m wanting to detect a collision but instead of not being able to go through the object when colliding I want to stop the physical response.
I have some code that I have downloaded and messed around with but am not entirely sure of where this would take place. Any help would be good as i’ve been stuck on this. At the moment I’m trying to register when a player enters the “zone” which then says “you are in the spawn zone” when they go out of the zone it says “not in spawn zone”. So all i’m needing is to stop the phyiscal response of the Cube which i’m not sure how to do.
At the moment I have a box but i can collide with it, i’ve looked at settings to check whether i can turn this off but i don’t see anything.
const zone = new BABYLON.MeshBuilder.CreateBox(“box”, {
width: 300,
height: 200,
depth: 700,
}, scene);
If it’s a box collision object, I don’t know the exact math, but you could try something like calculating collision manually every tick by getting the distance between the player’s location and the box’s corner vertices < some max value.
Only problem I have is as it’s not my code i am actually developing from that Im not sure where this problem lies. I am wanting to just stop the collision response when i intersect with the cube, i have no diea where this is handled
scene.registerBeforeRender(function () {
if (yourTargetMesh.intersectsMesh(yourMesh, true)) {
yourTargetMesh.material.emissiveColor = new BABYLON.Color3(1, 0, 0);
} else {
yourTargetMesh.material.emissiveColor = new BABYLON.Color3(1, 1, 1);
}
});
this part of code add and execute conditional function before every frame render. if yourTargetMesh intersectsMesh yourMesh then yourTargetMesh material set emissive color to red else yourTargetMesh material set emissive color to white. so you can do there what you want and for this you dont need use physics engines. just use mesh.intersectsMesh(yourMesh, true) and return true or false or something else before every frame render
As i’ve already said there is a Physics engine but i don’t see where i can remove this in the code, it’s not mine as i got it from somewhere but it’s not their fault as this is a problem that lies with me. i just dont want no phyiscs response from just that cube