Isn't there a way to clean it up? Because that feature would be incredibly useful for bot vehicles.
Probably, but it's over my head. What it's doing right now is just firing a raycast down, and when it hits a brick it just gets the normal of the face it hit, and then calculates it with that.
I could probably interpolate it based on how diagonal we are to the x and y axis though, I was loving with it earlier
EDIT: Actually it might not be that hard, I could just set the look limits over time instead of snapping them. I'll forget with that too
can you clarify how you know what limits to set, as the limits would change based on direction you’re facing? are you comparing normal of face you’re on to your eye?
I'm using the transform of the skateboard, getting the rotation on the Z axis, and using that to identify whether or not I'm using the x or y Euler angle I got from the normal. For example, if Z rotation is between -45 and -135, or between 135 and 45, I know it's on the X axis, and then I can just flip it based on whether or not the angle is negative.
Taking that angle and turning it into a look limit is just dividing by 180 and adding 0.5. So if we're on a ramp that's 45 degrees, 45/180 + 0.5 = 0.75, so I set the look limits to 0.75 + 0.05, 0.75 - 0.05. If I need to flip it because we're facing in the negative direction, I just take 0.75 and subtract it by 1.
It's not the most elegant thing that's ever been done in Blockland but I could probably make it a bit smoother