T
T
th0m4sXD2017-09-19 20:42:48
Game development
th0m4sXD, 2017-09-19 20:42:48

How to implement shooting if the camera is not moving?

the game is from a 3rd person, the camera is not movable and not centered, and it turns out that when I aim at an object in the viewport of the game, the sight is on the desired object, but in fact it only seems so because of the location of the camera, but when I throw a beam - it passes by, since the sight is not actually directed at the object, can I somehow solve this, or just put the camera in the center of the screen?
I want to aim like this at 3:30 https://www.youtube.com/watch?v=-u5VnyjLq0c&t=356s

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
th0m4sXD, 2017-09-19
@th0m4sXD

Vector3 viewportPoint= Camera.main.WorldToViewportPoint(crosshair.position);
        Ray viewportRay = Camera.main.ViewportPointToRay(viewportPoint);

X
xmoonlight, 2017-09-19
@xmoonlight

An orthogonal camera that projects 3D onto the screen of the monitor plane ... It seems that it is needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question