Skip to main content
After a comment the OP mentioned that they were using Unity and C# which were relevant tags
Link
Spelling and grammar
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

I have a 3D game looking from top to bottom where I move the mouse to aim at targets.

I have a simple box (the player) with a sphere on its middle-front (that is the pistol) and a cylinder on its right (that is the machine gun).

When I use the pistol I can make the player look at the target in a way it can send the bullets in the correct direction and it will hit the target position... that's okay.

The problem is when I send the bullets from the cylinder. It will not hit the target because it is attached to the right side of the cube. The bullets will come out of the cylinder straight forward and will pass near the target position. How can I rotate the player in a way that the cylinder will be pointing exactly to the target?

Best Regards, Etienne Gomide

I have a 3D game looking from top to bottom where I move the mouse to aim at targets.

I have a simple box (the player) with a sphere on its middle-front (that is the pistol) and a cylinder on its right (that is the machine gun).

When I use the pistol I can make the player look at the target in a way it can send the bullets in the correct direction and it will hit the target position... that's okay.

The problem is when I send the bullets from the cylinder. It will not hit the target because it is attached to the right side of the cube. The bullets will come out of the cylinder straight forward and will pass near the target position. How can I rotate the player in a way that the cylinder will be pointing exactly to the target?

Best Regards, Etienne Gomide

I have a 3D game looking from top to bottom where I move the mouse to aim at targets.

I have a simple box (the player) with a sphere on its middle-front (that is the pistol) and a cylinder on its right (that is the machine gun).

When I use the pistol I can make the player look at the target in a way it can send the bullets in the correct direction and it will hit the target position... that's okay.

The problem is when I send the bullets from the cylinder. It will not hit the target because it is attached to the right side of the cube. The bullets will come out of the cylinder straight forward and will pass near the target position. How can I rotate the player in a way that the cylinder will be pointing exactly to the target?

I have a 3D game looking from top to bottom where I move the mouse to aim onat targets.

I have a simple box (the player) with a sphere on its middle front-front (that is the pistol) and a cilindercylinder on its right (that is the machinegunmachine gun).

When I use the pistol I can make the player look at the target in a way it can send the bullets in the correct direction and it will hit the target position... that's okokay.

The problem is when I send the bullets from the cilindercylinder. it It will not hit the target because it is attached onto the right-side side of the cube. The bullets will come out from cilinderof the cylinder straight forward and will pass near the target position. How can I do to rotate the player in a way that the cilindercylinder will be pointing exactly to the target?

Best Regards, Etienne Gomide

I have a 3D game looking from top to bottom where I move the mouse to aim on targets.

I have a simple box (the player) with a sphere on its middle front (that is the pistol) and a cilinder on its right (that is the machinegun).

When I use the pistol I can make the player look at the target in a way it can send the bullets in the correct direction and it will hit the target position... that's ok.

The problem is when I send the bullets from the cilinder. it will not hit the target because it is attached on the right-side of the cube. The bullets will come out from cilinder straight forward and will pass near the target position. How can I do to rotate the player in a way that the cilinder will be pointing exactly to the target?

Best Regards, Etienne Gomide

I have a 3D game looking from top to bottom where I move the mouse to aim at targets.

I have a simple box (the player) with a sphere on its middle-front (that is the pistol) and a cylinder on its right (that is the machine gun).

When I use the pistol I can make the player look at the target in a way it can send the bullets in the correct direction and it will hit the target position... that's okay.

The problem is when I send the bullets from the cylinder. It will not hit the target because it is attached to the right side of the cube. The bullets will come out of the cylinder straight forward and will pass near the target position. How can I rotate the player in a way that the cylinder will be pointing exactly to the target?

Best Regards, Etienne Gomide

Source Link
Loading