[SOLVED] Arrow Shooting project issues


I am currently working on an archery game project.
A problem occurred while the project was in progress.

It works well when you shoot a straight arrow

but, If you change the angle and shoot the bow, the arrow will not shoot normally.

I used the code to implement the arrow shooting function.

//  Any value
this.entity.rigidbody.applyImpulse(0, 3.7, 18);
this.entity.rigidbody.applyTorque(3, 0, 0);
  1. Is there a way to calculate the x-value of applyImpulse according to the angle of the bow?

  2. Is there a way to get the angle of the parent Entity and give it relative strength?

Thank you!

Hi @issactoast,

Indeed both of those methods receive units in world space, so you will have to calculate them yourself.

A good starting point is using the entity.forward vector on the bow, that will give you the direction it’s looking to.

Check this first person movement tutorial on how it does the same to apply a force towards the direction the camera is facing:



It was solved well with the method you told me.

Thank you!! :slightly_smiling_face:

1 Like