In this script when an entity sees one other entity I want it to play a certain animation
if it does not see the entity it plays another animation
Hi @Mason_Rocchio,
For triggering a certain animation based on a certain condition this tutorial can be of help:
https://developer.playcanvas.com/en/tutorials/anim-blending/
Now, the concept of one entity seeing another is a bit vague. Usually it means creating a line of sight on a specified angle and checking if the other entity is in that line or not.
@albertos any tips on how to approach that? I think you did something similar in your game?
1 Like
The Basic enemy AI that I made for you, has this functionality. The boolean this.enemyCanSeeTarget
controls if the enemy can see the target, including the line of sight that @Leonidas mentoined.
if (this.enemyCanSeeTarget) {
// change animation here
}
else {
// change animation here
}
2 Likes
oh thank you