Ok so i need to figure out how to play certain animations when the “player” interacts with rigid bodies with a specific tag i think i might know how to do this but i need help becuase im about as good at coding as a dead cat.
somebody please
At what part are you stuck? On playing the animation or detecting the collision?
For the latter here is a good tutorial: https://developer.playcanvas.com/en/tutorials/collision-and-triggers/
For the animation you can prepare the sprite using the sprite editor:
https://developer.playcanvas.com/en/user-manual/2D/sprite-editor/
And to have it start playing in code you can use the sprite component API:
https://developer.playcanvas.com/en/api/pc.SpriteComponent.html
ii having trouble with the tag collision detection
heres an example if you are using collision start
script.prototype.collision = function(result){
if(result.other.tags.has("im a tag")){
console.log(result.other.name + " has the tag im a tag")
}
};
ok i tried something like this
use raycasting instead if thats so
that might work i do already ave a script that can detect your right and left sides but im not quite sure how to attach the sprite play script
this.entity.sprite.play('clip');