Okay so I am attempting to make my object jump. I use a ray to see if he is on the ground. If I am standing still it works just fine. If I am moving forward it does not. So clearly there is something wrong. Here is the current code for the ray to check to see if I am on the ground. The floor is flat. Oh, I am using physics to move the character.
var from = translation.Value - new float3(x: 0f, y: 1/2f, z: 0f);
var to = translation.Value - new float3(x: 0f, y: 1/2f + 0.1f, z: 0f);
var input = new RaycastInput()
{
End = to,
Filter = filter,
Start = from
};
var hit = collisionWorld.CastRay(input);
return hit;
It is my assumption that there is a better way to get the from and to for this. I have a feeling that using the translation to get this is not a good idea. Not sure what the proper way would be.
Second question, related to the first question. If I hit the jump button fast enough, he will jump again and again, ignoring the fact that he has not landed. Again I assume the translation is affecting this.
This leads to another related question, or maybe the same question. If I hold the forward button down and run into a wall, I bounce off most of the time. Sometimes eventually I just go right through the wall. Is this just physics engine not being able to keep up?