Get a point at a set distance with vectors?

Hopefully not too silly of a question, but I'm messing around with FlagRush and would like to implement logic to slow (or speed up) the player when they go up a hill or down. Ideally, if the hill is too steep, they stop. I figured the easiest way to do this would be to pick a point one "step" ahead of them or behind if in reverse and see what the difference in height is. I know the vehicle's current location is localTranslation and their current direction they are facing is localRotation. So I just need to grab a spot, say .1 units (lengthwise) from the localTranslation in the direction of localRotation (if going forwards) or opposite if going backwards.



Is there an easy way to do this with vectors? If so, what does the code look like? I was think of just falling back to 2d math but I remembered this was easier with vectors. It's been a while for me with the vector math obviously  :slight_smile:

Feel free to delete this. I found the answer and wasn't sure if it'd come in handy for other. It was pretty much the same as adding velocity to the bike normally. So, this should do it (seems to from what I can tell). hDiff is the difference in height.



Vector3f tempVect = new Vector3f(localTranslation);
Quaternion tempQuat = new Quaternion(localRotation);
tempVect.addLocal(tempQuat.getRotationColumn(2, tempVa).multLocal(.5f));

float hDiff = terrain.getHeight(tempVect) - terrain.getHeight(localTranslation);
System.out.println("y diff: " + hDiff);