Showing posts with label Coding Tutorials. Show all posts
Showing posts with label Coding Tutorials. Show all posts

Sunday, March 10, 2019

Cursor Locked Mode

In Unity, you can lock the state of the cursor while in play mode, effectively turning the cursor invisible and constraining it to the center of the screen so that you don't accidentally click on anything while playing, which can happen often and is very problematic. Being able to lock the cursor is very helpful for both playing and testing games. These are the two lines of code that do the trick, tough some additional scripting may be required:

  1.         lockMode = CursorLockMode.Locked;
  2.         Cursor.lockState = lockMode;

Additional resources on cursor locking in Unity and other cursor modes:
https://docs.unity3d.com/ScriptReference/CursorLockMode.html
https://docs.unity3d.com/ScriptReference/Cursor-visible.html
https://forum.unity.com/threads/disable-mouse-cursor-in-windows-during-play-mode.387416/

Saturday, March 2, 2019

Jump Code Tutorials

Unity Jump(more advanced):
This one was good, but a bit too complicated, and would only work if the object with my animaton controller script was a child of the object with my movement controller script, which is not ideal.
https://www.youtube.com/watch?v=vdOFUFMiPDU

Unity Jump:
I found this simple method of jumping to be more effective for my current needs.
https://www.youtube.com/watch?v=oikSPEfIk-Q

Jump friction sliding down wall:
https://www.youtube.com/watch?v=lj5VngpUB_4

Better Jumping:
https://www.youtube.com/watch?v=7KiK0Aqtmzc

All Updated State Machines and Blend Trees

These are all of the State Machines and Blend Trees that I set up for my character in Mecanim: