Back to zero

So my camera was titled in such a way that you can see the sky, mouse-clicking on the sky means that the ray fails to hit a location, so returns vector3.zero sending our movement back to origins.

The issue I’m thinking is if we check and skip moving to said space, if a player wanted to move to 0’s then they will be blocked?

You can refactor the mouse position script to either add a bonus function to test if it hit something, or on the position function itself to also return if it hit something.
Possibly rename it to bool MouseWorld.TryGetPosition(out Vector3 mousePosition);
return false if it hits nothing, and if it does return true and assign the mousePosition

2 Likes

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

Privacy & Terms