Why is my velocity changing, but my object not moving?
Okay,
So I am attempting to make a climbing wall, similar to Super Mario World. The problem I am having is that when I tilt the joystick in the inspector, I can see the velocity change, but the object doesn't move. The worst part is, is that this only happens in the -y direction. The other 3 directions(both x and +y) work fine.
Here are the segments of code that should be relevant.
public void HandleClimbingMovement(float hleftAnalog, float vanalog)
{
rb.velocity = Vector3.Lerp(rb.velocity, new Vector3(hleftAnalog * moveSpeed, vanalog * moveSpeed, 0), 10f);
moveDirection = rb.velocity;
}
Here is where the input happens:
public void ClimbingInput()
{
if (Input.GetAxis(HLeftanalog) > 0 || Input.GetAxis(HLeftanalog) < 0 || Input.GetAxis(VLeftanalog) > 0 || Input.GetAxis(VLeftanalog) < 0)
{
PMovement.HandleClimbingMovement(Input.GetAxis(HLeftanalog), Input.GetAxis(VLeftanalog));
// FlipPlayerCharacter(Input.GetAxis(HLeftanalog));
}
}
Again, this works in 3 directions, just not the down direction, and I can see in the inspector moveDirection showing -5 in the y axis while i hold the left analog stick down.
Your answer
Follow this Question
Related Questions
Making a game object follow the player C# 1 Answer
Got unwanted motion blur on fast moving object (Only iOS) 0 Answers
Arrow mechanic like soccer star 0 Answers
I don't want the arms to turn with the ball at my game 0 Answers
MotionBlur 0 Answers