[SOLVED] Shooting arrow code

Hello, i’m tring to make the character fire an arrow, after fighting with the range weapon (so i will be able to change it based on weapon equipped later) i have used this code

shoot: function (event) {
        this.model.animation.play("orc club attack.json", this.blendTime);
        this.model.animation.speed = 0.5;
        this.model.animation.loop = false;
        var arrow = this.arrow.clone();
        arrow.enabled = true;

        this.force = new pc.Vec3();


but it give me an error on the last line (arrow.rigidbody is undefined)…what did i do wrong?

My guess would be that findByName is not returning what you think it is. You may have another item in your hierarchy that is being found first, which does not have a rigid body component. Set a breakpoint and inspect this.arrow.

I think your guess could be right coz i have tried to move the arrow entity on top of the hierarchy and when the function is fired all the canvas goes white (???) now will try to change something

Wow cool, i have changed the rigidbody to kinematic and moved the arrow entity just under my terrain entity and when function is fired the terrain disapared. Magic Arrow LOL
Edit: correction, it doesn’t disapear…it get fired

Seems i have made it somehow…needed to put an emissive source to the arrow to see it :stuck_out_tongue: