Hello again:)
Im fighting with an issue, how to keep player unit inside area. But in this case this inner space has cone like shape. And unit can be near to the top or bottom. Because shape is 4side cone, dimensions are different in term of height too. Smaller area on top larger at bottom. Here is picture:
https://drive.google.com/file/d/1X2OGJxhjaC3ofaxM2dZ3w3TIwy-MMfka/view?usp=drivesdkYou can see it on middle picture.
In pic.2 you can see that perpsective of camera creates non linear view. And within this area I have to keep the player.
My first idea was to do this with angeled boxes with enter trigger. So when you go right and hit Ill clamp X axis on joystick (getting Horizontal and Vertical axis). But when I moved up/down player unit made a ugly zigzag effect as it went by side on angeled wall (still same height level).
So doesnt work.
My second idea was only make walls physical and collision with player should stop it. But then I need Riggidbody as Kinematic and then starts to rotate and jump away. So doesnt work for me, at least what I know:)
Third idea was do a 4 raycast in every direction and clamp its destination. So when destionation from wall lower then 1 I have to clamp that direction.
If I compare values then I should go to another node, there should be again getting joystick axis and clamp value of that direction and again raycast which stores destination from a wall + compare if value that destenation is bigger then 1 go back to previews node (base) this should be for each direction.
And lets say if this work what happen if you are in the corner.
Is it some easiest way how to do it?
Thanks
Martin