https://www.youtube.com/watch?v=jRcodiPLwfs
So with:
Code:
newangles = VectortoAngles(newPos["normal"]) + (0,90,0);
orangePortal.angles = (newangles[2],newangles[1],newangles[0]);
Its working as it should. Its flat to the walls and flat to the floor and ramps.
Still weird that somehow x,y,z changed.
With orientToNormal the portal is still rotated into all directions. The values doesnt seem to be correct is you can see in the prints.
Now there are 2 problems left until the portal placement is done.
1. Sometimes the portals are stuck inside of the wall. (Video at: 0.04)
2. For some reason its sometimes not taking the direction that it should. (Video at: 0.25)
You can see that when i place the portal on the ground, its 90° rotated.
Obv. thats only the case if i look in that direction, if i turn myself 90° the Portal is correct.
So it seems like its not using the direction the player is looking at.