I'm currently making my Jump action after i realized that the Jump action for the FPS Cam is awful.
I did "everything" but i got stuck on a very important check that is the main reason why i decided to make my own Jump: the ground distance check.
If i won't check that, i would be able to to jump and jump and jump in the air... and i don't want that.
I tried to use this
Code: Select all
bool collision(ICameraSceneNode* one, ISceneNode* two, int size) {
if(one->getAbsolutePosition().getDistanceFrom(two->getAbsolutePosition()) < size)
return true;
return false;
}
But then i realized that it won't even help me, because it will calculate the distance from the center Y of the map (y axis: 0):
So basically it will calculate the distance from 0 to 50, so the distance would be 50.
But if i was on a lower floor?
lets say on y axis -50, the distance would be -50, and these are different things.
Say after i explained the problem, i need to get a distance of 0 from ground to camera, so it means i need to get the distance from the nearest ground below the camera and the camera.
like this:
So how i can i do that?