[SOLVED] How To Create Automatic Aim, So That Bullet Shoots At Opponent Automatically

So, in our game, we want to make it so each player automatically points at each other. But I have no clue how to do that… I also would like some help with a gun script, were it will shoot a bullet that will hit the other player and knock them off. The reason I need the pointing is so the bullet will shoot at them, kind of like aim-bot. But the bullet will move slowly, but not too slowly.

Check it out here: https://playcanvas.com/project/660369/overview/yeet-wars

If you didn’t get what @BloodStorm0606 said (I’m the other person working on the game), then what he was trying to say is that we want to create an automatic aiming system where the aim automatically aims at the opponent. Should we use raycasting or something similar to accomplish such event?

Edit: Also please don’t flag, I’m trying to help with explaining the main problem.

So you guy’s want some type of Ai/Algorithm that aim’s the bullets to the other player I would suggest using some x and y points and point the bullets to the direction the player is at.

How would I accomplish that though?

1 Like

You can use the lookAt pc.Entity method to have an point to a world point. To point to another entity simply do:

entityA.lookAt(entityB.getPosition());

https://developer.playcanvas.com/en/api/pc.Entity.html#lookAt

2 Likes

@Werdie_Alt & @BloodStorm0606 thanks you