Why use a "manual" formula?

Hi!

When I watched the video I immediatetly thought that there also must be some integrated functionality in Unity to convert screen coordinates to world coordinates.
And after a very quick research I found out that there is indeed a built-in functionality.
I used
float mousePosInUnits = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
and this does the trick.

Why are you using an explicit formula here?

1 Like

Hi Thomas,

Your question may be better suited for the Q&A on Udemy as you are more likely to get a response from the instructor there than here - just for future reference etc.

I’ve not seen the code myself for the alternative, manual, approach but I suspect it may just be to introduce students to things gradually.

That said, why don’t we tag @Rick_Davidson and see if he has an opportunity to chime in and share with you his reasonings :slight_smile:

Yep, good question. There are often many ways to skin a cat so to speak and personal preference is often the reason why. We do both ways in various stages in this course - the approach we used in this first instance was just to make it clear about what is going on, not necessarily that it is better.

1 Like

Thanks for your reply Rick, that’s what I imagined :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms