Portals Demonstration

nice, i tried to do this once but i failed terribly

Um, I know absolutely nothing about scripting…

The math is trivial really - it’s just unapplying the transformation of the portal you’re entering and then applying the transformation of the portal you’re exiting through. The code involves 3 passes (see the pss loop):

  1. Update video texture (only needed if you show the portal)
  2. Remove old fake objects
  3. Create and move/orient fake objects

If you only want the physics part, just do passes 2 and 3. Note that they must be done as passes (not both for each portal serially), since you don’t want new fakes crashing into old fakes.

A few people here and privately have asked about re-using the code in their own projects. I attached a GPL license notice on the file to keep it simple for people producing other GPL content. I come from a free-software background, so that’s my habit. But looking now at what other people do though, most posted scripts have no copyright attribution or grants at all. Strictly legally, that makes them unusable (the “default” under law is no grant of rights), which is surely not what the poster intended.

I’ll change the grant of rights in the attached blend file to Creative Commons BY NC SA. Hopefully this is even clearer and easier for people. Contact me privately if you want the NC waived.

Thank you soooooo much dude! That’s incredible! Congratulations for this minimalistic beautiful-clear-usable setup!

Nice reference on blendernation!

Umm i tried it in both 2.49 and 2.48 and it didn’t work. Help?

Worked great for me. Good work!

Hey!
It doesnt work at all here! :frowning:
Im using Blender 2.49 on Linux Fedora 10, with and NVIDEA card.
Can anybody help me?

There is a lot of fun to have with this. For example, place an object over a static up-facing portal to exit a down-facing, falling portal. The simulation really wonks out.

impressive

hmm, I get an error on line 39, stating that the argument type of KK_GameObject is not iterable.

		if 'otherportal' in portal:

Most code snippets posted are ‘functional’ and not ‘expressive’ in nature and therefore probably would not meet meet the requirements to be copyrightable in the US. As a work (code plus artwork/portals) it is copyrightable, but it is questionable whether the courts would hold the code itself to have any copyrightable interest.

LetterRip

Didn’t work for me. Open Blend. Alt-P on text.

Compiled with Python version 2.5.2.
Checking for installed Python… got it!
Traceback (most recent call last):
File “portals”, line 26, in <module>
ImportError: No module named VideoTexture

So when that didn’t work

I tried copying the text converted it to VideoTexture.py in the same location as the .blend
That didn’t work.
The game controls the ball, physically moving the portal boxes.
Console repeats this error:
Python script error from controller “cont1#CONTR#1”:
Traceback (most recent call last):
File “portals”, line 39, in <module>
TypeError: argument of type ‘KX_GameObject’ is not iterable

Then I typed this sadly.

WIndows XP Blender 2.49a AMD 4000+ 2 gig ram Nvidia 6800oc Wireless keyboard.

P.S. Other Video Texture Demos I can get to work.

Yeah i cant get it to work either. I hit play and the ball moves fine but i get no video textures on the boxes, just white with a red plus sign. When i run the ball through the portal it goes through the portal but doesn’t come out another one, it stayes in the box and pushes it around. I tried running the script in blender but it there was a
[python script error: check console] on line 26, import video texture.

I’m running blender 249a on Windows XP.

Yes. They modify collision data based on portal placement.

I think they might have actually used a method to split up the objects between portals, too, so if the portal was on a shallow wall objects wouldn’t bump into the other side. (for example, portals can be placed on very thin panels, and long objects can still pass through them without issue)
Now that I’m not sure of, but that would certainly be more difficult to implement.

I would agree. Also, while the results are certainly impressive (due in no small part to the implementation of the new video texture module), the code itself is rather trivial, and the mathematical ideas behind the implementation are certainly not his original work.

Public Domain would make more sense here, but that’s just my opinion.

@warwickallison

Nice demo. Keep up the good work.

This, is really REALLY cool :slight_smile: I’ve tried the demo scene and I’ve had quite a bit of fun. Thank you!

Hi, I have bad news :
When launching the game engine, your blend file is detected like a virus or an infected file by Bit Defender. It is the first time it occurs with a blend file !

I also get a problem when trying to import the VideoTexture. =/ Too bad.

Same Here.