Imagine a (x,y,z) coordinate system within a solar system, with (0,0,0) beeing the center of sun where Z axis goes thru both solar poles.
I'm standing on a planet inside a house within that solar system.
Now from my perspective Z axis is skewed in unknown direction depending on where exactly the planet is at this moment.
What would be the steps I should take to create a local coordinate system with (0,0,0) being the house and where Z axis is perpendicular to the ground/house, so that I would be able to convert coordinates from local to global.
I have the global coordinate of my house and directional vectors for where is up/forward/right for my house.
I have some limited knowledge of vector math and projecting vectors on other surfaces, but there is a gap in my understanding that keeps me from solving this.
local housePos = vec(getHouseWorldPosition()) -- (x,y,z) position of house in global cooridnates (housePos.x,housePos.y,housePos.z)
local vRight = vec(getHouseWorldOrientationRight()) -- X directional normalized vector
local vForw = vec(getHouseWorldOrientationForward()) -- Y directional normalized vector
local vUp = vec(getHouseWorldOrientationUp()) -- Z directional normalized vector
local playerPos = vec(getPlayerWorldPosition()) -- players position in global coordinates
--Now how to get players position in coordinate system relative to housePos, with Z axis going along vUp vector