Tidying Up Our Projectile Weapon

Thanks to everyone who has given us feedback that the projectiles have been acting strange in certain circumstances. In this lecture we resolved some of the issues. If there are still any problems please let us know.

1 Like

I solved the challenge in a slightly different method at first. Rather than using Start, it made sense to me to use the transform.LookAt() during the SetTarget method called right after instantiating in the weapon script.

With adding in functionality like Destroy after X seconds, it’s clearly better to go with the Start method like you guys did.

I put in some rad effects for my homing arrows, and had the arrows stick once they hit the target.

1 Like

Hi there! if i may ask : are u destroying ur projectile wich is sticked to the “character” when he dies using OntriggerStay()? cause seems not working for me .Made it stick to characters aswell but when they die it only gets destroyed with my Destroy() method (wich i impemented to destroy projectiles wich actually went into the world jsut by timing it)

1 Like

well, this is my version of OnTriggerEnter code - I make arrow abitily find other target if it meet it on way, and it also responsible for obstacles on the way:
Снимок экрана от 2022-02-15 17-53-06

That’s my approach as well.

I add additional animation event - now I create arrow when she take it from quiver. Arrow instantiate as parent object of right hand transform. Once she lay it at bow and become ready to shoot - other Animation event strike - shoot which enable Update movement, and change the parent - I make Core object as a parent for shooted arrows because it don’t move. Also I destroy arrow if she not shoot it and Fighter cancel. For this reason I always store last instantiated arrow in a variable. Btw my Fighter script much more complex, there are animation for defence actions and for got hit. Its all cancel shooting and destroy current arrow if it not launched and not null. I add quiver after this video.

2 Likes

Nicely done! Great job with the modular assets as well!

Privacy & Terms