How would I make it so that every time the players hammer collision comes into contact with a tree, rock or bush it adds to the text by 1 to 5 or so?
I would add a kinematic rigidbody component and a collision component to for example the rock. I would add a collision component to the hammer. In a script, like the script from the tutorial page below, I would check if the the trigger has collision with for example the rock. If so, you can update the text with a new value.
https://developer.playcanvas.com/en/user-manual/physics/trigger-volumes/
I got a sample here:
var TriggerVolume = pc.createScript('triggerVolume');
// initialize code called once per entity
TriggerVolume.prototype.initialize = function() {
this.entity.collision.on('triggerenter', function (entity) {
console.log(entity.name + ' has entered trigger volume.');
});
this.entity.collision.on('triggerleave', function (entity) {
console.log(entity.name + ' has left trigger volume.');
});
};
maybe we could add an attribute text entity called rock text, then update the text by 3 every time it enters the collision?
Yes, that’s a way how you can do that.
Can you share an example of how that is done?
I tried to create sample code, but I realize it’s a bit more complicated to write the code without testing. As I mentioned before, I have no experience with multiplayer games, so the code I’m be able to write probably won’t fit your use case.
I am on on other account btw and it does not need to display to all players just you
May I ask why you use two different accounts?
Well, I am on my mobile account. Right now I am in kansas, and I can confirm so on my other account if you do not believe me.
The other account is for my PC.