Hello, I would like some help with my script please.
So this is my script.
var ColliderLeverPull = pc.createScript('colliderLeverPull');
// initialize code called once per entity
ColliderLeverPull.prototype.initialize = function () {
this.entity.collision.on('collisionstart', this.onCollisionStart, this);
};
ColliderLeverPull.prototype.onCollisionStart = function (result) {
if (result.other.rigidbody && this.entity.animation) {
this.entity.animation.play("pull animation");
}
};
What I want is the object (In this case the lever) to play an animation when I touch it.
I already have the animation ready and I added an Animation Legacy component to the entity, but when I touch it Nothing happens so I would really appreciate some help.
And thank you very much