i was quite bored the last few hours. so i decided to throw together some portals in panda.
its not complete, not even close. and the visuals of the portals are buggy under certain circumstances.( like having recursive portals and standing very close to it. or some aspect-ratio border issues)
but for everyone who likes to mess around with.
there it is: http://thomaseg1.p3dp.com/samples/portaltest.zip
controlls are keyboard-arrows +mouselook. esc to exit.
level,textures etc done in blender+gimp.
[edit: updated url]
Excellent example, thanks alot!
(for the clarity, you might wanna add a topdown view to the sample so the effect becomes more visible)
Also I had to enable fps capping before moving around was slow enough
jeah sory baout the fps-cap. i didnt use any frame-rate independent formula^
usability wasnt my main focus for this one but glad you like it.
i just played portal from valve yesterday the first time and asked myself how i would code the effect
thanks for the sample!
the code lines for mouse movement detection don’t work for me :-/
pointer position reporting is okay - it’s rather the part where you subtract the half of window size from pointers current position and set it to center again immediately after that.
most often the difference window_center - pointer_pos is 0
effect: jumping camera from time to time on continous mouse movement.
am i the only one with this ‘bug’?
no you’re not - but this could be a nice opportunity for you to refine your coding skills with Panda, couldn’t it?
by the way thanks Tom for the inspiration
i’m currently working on a bit more advanced demo.
the new one will include the possibility to place portals yourself. aswell as basic player movements such as running and jumping. i just need to fix up some collision lines aswell as a movement error when you jump into a wall-portal but get out of a ground/ceiling one.
new one will still be non OO-code so. nothing you could re-use unless you copy&paste it into some better form
btw. i never experienced any mouse-movement bugs in the old code. (running ubuntu 8.04 and panda’s cvs version dated around december)
I’m thinking about to melt your code and another ODE snippet to make a ODE portal showcase to have a complete room a-la Portal Source - I’ll wait your next release of this code before to start.
my portals dont integrate with ODE too well. since you’d need to tell ODE to NOT let the stuff collide with the portal geometry or the wall/floor behind it.
aside from that i havent wrote any object-through-portal code. except for the camera itself. if you can manage to tell ODE to ignore collisions in a certain volume it would work.
a small update, its still very buggy and far away from being of any real use.
but at least you can now walk and jump around, it has some collision detection and also allows you to place new portals with left/right mouse button.
-jumping through a horizontal/vertical portal combination results in wrong momentum
-collision for the floor-portals is bugged like hell
-portals can be placed semi-off a surface resulting in strange visual effects
-changing the window size /aspect ratio breaks the texture projection around the borders
-dead code and no useful comments
-propably a lot more… but i’m not going to fix them.
feel free to use the code for whatever you want.
my advice: rewrite it from scratch. especially movement, its a single big mess. good luck in case you’r trying.
thanks Thomas I will give it a look. Your code was very easy to follow once you explained what portals were in the chat room.
Can you also post a zip pls? I would like to test it on my windows machine.
indeed. btw, using a good,free and opensource unzipping-tool like 7-zip you should be able to open the first one,too.
Oh noos, srry I watched over that one >.<
about the model: from the screenshots, your vertex-normals arent well arranged, a few slipts around edges will improve this (and will also fix lighting errors). also try to “bevel” the outer edges. it will look more like the original one.
ThomasEgi: I don’t think the verticeies are incorrect, if you’re talking about the third screenshot, I think it looks that way because of milkshape getting confused about my shading groups. I’ll check anyway tho
By bevel, do you mean add a bevel to the 8 major lines of the cube? _if i get time and motivation, I’ll do tht too. Thanks for the feedback.
Man that was cool! I got the portals in a direct line and jumped through into a infinite fall thru them! I got dizzy that was so sweet.
(I know a simple toy for my simple mind)