Player controller flies when you climb up terrains and move
towards the center , this is a bug we noticed a few weeks back but I forgot to
address the issue back then due to doing other tasks . The problem was very
simple but took me a while to understand with the help of our facilitator. The
problem was that I was using velocity for movement but I did not take into
account the velocity of the gravity which made the player look like it was flying
although this was not the only problem with the movement, the player needed to
move in the direction the mouse was pointed in as well.
To address the flying problem, I specified the vector the
player should move in the 3rd line of code by creating a new vector
where the x & z input would be taken by get axis.
second problem was that the forward of the player should be
the direction it is looking In which is solved by using Transform Direction
which converted from local to world space and resolved this issue . Lastly the
5th line of code takes the actual gravity into account which needs
to be added after the calculations for the new vector are done or else there
will be another bug where the player would look like they are flying as long as
the movement keys are pressed.
Another bug I solved during the week was with the jump
mechanic where in you could keep jumping as long as the jump key was held down
, this was easily solved by creating a bool which would be true when the player
is on the ground & false when he is jumping , as can be seen in
the code below .
There is also a minor bug in the
door animation playing as it takes a long time for the animation to play which
is not a problem in my code as I have tested it thoroughly . After looking the
bug over our facilitator it turned out that there was a problem un the animator
state where one of its transition settings”has exit time ” was checked which
would exit the animation every time it was called .


Comments
Post a Comment