Isometric shooter - Bullets
So, I'm having the exact same problem as this guy is having https://answers.unity.com/questions/1482219/shooting-a-projectile-with-isometric-view.html
My scripts works the same way, a ray cast in order to know position of cursor, create a bullet, add angle, move it forward. I'm working with a 3d scenario, with a fixed camera on top for the isometric effect.
I know that the bullet might be going, not exactly where my cursor is, but in a direct path between the cursor, the Y axis, and the Y value the bullet has.
This is what my script looks like.
public void ShootingToClick(RaycastHit dest) {
Bullet newBullet = new Bullet(Instantiate(BulletProperties), dest, System.DateTime.Now);
newBullet.GO.transform.position = this.transform.position + new Vector3(0, this.transform.localScale.y / 2, 0);
newBullet.GO.transform.LookAt(new Vector3(dest.point.x, newBullet.GO.transform.position.y, dest.point.z));
Bullets.Add(newBullet);
}
Update has
B.GO.transform.position += B.GO.transform.forward * BulletSpeed;
If I erase the Y axis, and leave it as it comes from dest then it works explendid, but, the bullet also goes up and down and its not what I want to happen.
Same pics the other dude posted:
Dont really know how to fix it, tried working with a target but its really confusing to shot like this.
Answer by Frikifexfb · Mar 16, 2021 at 04:30 PM
Well, in order to fix this issue I created an invisible layer (the green one), at the same height as the bullet will be, and used a raycast against that layer in order to get the direction of the bullet.
Thanks to Perrito Facherrito on discord as he gave the idea =)
Your answer
Follow this Question
Related Questions
Shoot until i release the button, but with a fire ratio 2 Answers
Test if a bullet will hit before shooting it? 2 Answers
2D Platfformer 0 Answers
Help me to make a delay when shooting 0 Answers
How to make a bullet in a top down arcade-styled game? 0 Answers