Hey there.
This week I encountered a bug.
It was a bug in the jumping system of the snail.
I've made a script that makes a snail move in a downhill slope. The script did it this way:
This week I encountered a bug.
It was a bug in the jumping system of the snail.
I've made a script that makes a snail move in a downhill slope. The script did it this way:
1. Ensure that the snail isn't jumping (using colliders)
2. Raycast to the ground
3. Stick to the ground
The problem were when the snail jumped into a wall in mid-air, it would instantly teleport to the ground. So what caused this?
The error were hidden in the code of step 1. Because that I used colliders, the snail could not determinate if the wall in mid-air was the ground. Therefore, I now use raycasting to check if the player is on the ground.
Remember, colliders and charactercontrollers might be easy to use at first, but later on they might not work as you want them to. If you have the time, I'll recommend you to write your own scripts for everything, and make sure that they are re-useable. That way you will not only learn a lot, but you will also spend you time with care.
See ya later.
- Wituz
2. Raycast to the ground
3. Stick to the ground
The problem were when the snail jumped into a wall in mid-air, it would instantly teleport to the ground. So what caused this?
The error were hidden in the code of step 1. Because that I used colliders, the snail could not determinate if the wall in mid-air was the ground. Therefore, I now use raycasting to check if the player is on the ground.
Remember, colliders and charactercontrollers might be easy to use at first, but later on they might not work as you want them to. If you have the time, I'll recommend you to write your own scripts for everything, and make sure that they are re-useable. That way you will not only learn a lot, but you will also spend you time with care.
See ya later.
- Wituz