- Home /
make one thing flat to another
im working on making a portal style mechanic that works on anything, so i need it to work on any surface, my problem is that if i shoot a portal on a surface thats at a weird angle it just looks off and awkward, how do i get the portal model i've made to be flat against the surface its being shot at?
TLDR : how do i get the portal model ive made to be flat against the surface its being shot at?
Reword your question, its hard to get what you are asking. How is it "weird". Need better details.
Answer by Piflik · Jun 29, 2012 at 08:35 PM
There is a reason why Valve allows portals only at locations that follow some rules: i.e. flat and big enough ('white' is not a technical reason, that is only a gameplay mechanic)...it is very difficult to make them work on arbitrary surfaces. With flat surfaces it is quite straight forward: all you need is the surface normal (and the center of the 'tile', so the portal doesn't appear at a corner and sticks out of the wall)...from the top of my head I can't think of a mechanic, that would work with curved surfaces...you could try painting the portal on the surface using projectors, and a collider to move the player to the outgoing portal, but that would probably not look or behave like the real deal...
are you saying that valve pre set the angles of the portals that will hit them so that they always look right? i have a few ideas of how to do it but im not sure if they will work 100% :S
Unfortunately, if you have tried Portal, you can actually shoot through the seams between walls. I think they used a variation of their "you can't shoot here" walls to cover up the corners, leaving a tiny gap there that you actually can shoot through.
The angle doesn't matter, only that the surface is flat. If you have the surface normal, you can rotate the portal accordingly.
@$$anonymous$$nightleaf: I thought the angle was decided by your character's orientation when they shot the portal? I haven't played in a while, but I thought that was how they did it...