D
D
domenik12019-07-02 15:39:45
Game development
domenik1, 2019-07-02 15:39:45

How to compare 2 textures in Unity3D?

Hello. The question is as follows: There is a reticle of an optical sight (well, or just a view from the sight, which is drawn through the GUI), and there is, at a certain distance, another sight (collimator), on which the same reticle, but enlarged. According to the task, it is necessary to combine the reticle from the optical sight and the collimator reticle (only along the X axis). And actually the question itself: how, in the logic of the unit, to check that the grids are aligned correctly (well, based on this, display a message that everything is correct)? i.e., in fact, you need to somehow compare a piece of the first texture (sight) with another texture (collimator), well, or somehow pinch this moment. For clarity, I will attach a screenshot.
PS The location of the collimator relative to the sight can be different, so comparisons should work correctly in any part of the screen
PSS The texture of the reticle on the collimator and the texture of the reticle from the sight is the same, just on the collimator it is increased by means of the unit through tiling, and moves left/right by changing the Offset.x parameter5d1b50327661a800679577.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Boronnikov, 2020-07-20
@red-cat-fat

If I understand the question correctly, it's worth using RenderMode - WorldSpace and attaching the reticle to the scope. And there it's just to connect the math from the category "are there 3 points on 1 line (camera, grid 1, grid 2)".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question