like level loading. so i want it so that when the player walks toward a different part of the map(seperate from the spawn area), it will load in, but if the player is not near it, it will be disabled
how would i do this?
Hi @quantum!
You can achieve this with using triggers or check the distance from the player to the location point in your map.
Using triggers:
https://developer.playcanvas.com/en/user-manual/physics/trigger-volumes/
https://developer.playcanvas.com/en/tutorials/collision-and-triggers/
Using distance:
// update function
var player = this.app.root.findByName('EntityNameOfPlayer');
var point = this.app.root.findByName('EntityNameOfLocactionPoint');
var range = 10;
if (player.getPosition().distance(point.getPosition()) < range) {
// enable
}
else {
// disable
}
2 Likes
thanks i will try it