Hi guys! I was trying to recreate Battlezone and I want to know how do I make it so that the the projectile will shoot in the direction I’m/the camera facing. I’m using the 3d render for this and I don’t know how to make projectiles face the way the camera is for 3d.
3 Likes
the issue is that your not changing the playerAangle value. Also, atan2 returns radians (not degrees) and I think you have the sin/cos mixed up
1 Like
Thanks Voxel! I got it working now.
You were right to point me toward the angle calculations. Since I’m using the raycasting extension, the solution was to use the renderer’s direction vector (dirX and dirY) instead of calculating the angle from the crosshair. I didn’t even need the function that updates the player’s angle! Projectiles are firing correctly now.
1 Like