This is kind of what you want, pay attention to the track axis of the edit object and ray, make sure they are the same orientation as your cube now this works for one door but you obviously want more than one door, so you have to workaround the fact that the track to actuator only tracks objects. you have two options
python - use python to track via property
logic - im imagining some kind of workaround where it tracks one box; ‘door’ that is invisible and what not, added ontop of the textured doors when the player is near, and deleted when the player is not. this way you can still only track to the one object that just gets jumped around the scene. this could get messy, let me know if you want help with the track via property i think i have a script somewhere
give the object u want ur character to snap to a property ( boom )
from bge import logic
def main():
cont = logic.getCurrentController()
own = cont.owner #your character
scene= logic.getCurrentScene()
obs = scene.objects
for i in obs:
if "boom" in i:
target = i
own.worldPosition[0] = target.worldPosition[0] # assign xposition
own.worldPosition[1] = target.worldPosition[1] # assign y position // adjust it with plus or minus a number
own.worldOrientation = target.worldOrientation #making ur object face to same direction / adjust it on your will
main()
Similar to rockys post, this will only set his rotation to that of the door.
import bge
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
own = cont.own
eKey = cont.sensors['Keyboard']
ray = cont.sensors['Ray']
if ray.positive and \
eKey.status == bge.logic.KX_INPUT_ACTIVE:
#set orientation to that of the door
own.worldOrientation = ray.hitObject.worldOrientation
#set x and y, hers where it gets tricky depending on the orientation of the door
own.worldPosition.x = ray.hitObject.worldPosition.x + 1
own.worldPosition.y = ray.hitObject.worldPosition.y