Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I use this code to get the raw player height, without it being poluted by whether they are looking up or down (which raises/lowers the HMD). Is this the best approach? It seem to work for my index.

var head_up_value:float = 0.08
var head_down_value:float = 0.1

func get_cam_y_corrected():
    var corrected_cam_height:float = 0.0
    if $/root/World/Player/Cam.rotation.x > 0.0:
       print ("correct with head_up_value")
        corrected_cam_height = $/root/World/Player/Cam.position.y - ($/root/World/Player/Cam.rotation.x*head_up_value)
    else:
        print ("correct with head_down_value")
        corrected_cam_height = $/root/World/Player/Cam.position.y - ($/root/World/Player/Cam.rotation.x*head_down_value)
        return corrected_cam_height