Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[RELEASED] Portalizer package

Discussion in 'Assets and Asset Store' started by ggappleid, Oct 27, 2011.

  1. ggappleid

    ggappleid

    Joined:
    Nov 2, 2010
    Posts:
    82
    PORTALIZER PACKAGE - 35$



    LINK DEMO

    This package contains scripts and shaders that allows you create connected portals, which you can use for fluid Objects or CharacterControllers (scripted manually using template) teleporting. It's could be a complex object with a couple of renderers and animation. You should have advanced scripting skills, to make it work in your game. You can get this package for FREE (details at the bottom)

    IMPORTANT NOTE
    This package do not include collision controller disabler. Your objects will collide with colliders behind the portal. This package used for visual part only.

    This package requires UnityPro

    Where this Portalizer could be helpful?
    You can use it in complex scenes, where you don't want to make holes but they are needed (for example on terrains for buildings or caves). You could connect few locations. You could make very nice eyecandy portals from one part of map to another (for example in RPG). You could use it for simple objects teleporting in games like RollABall or so. You could use it for some physics based games. Finally you could modify scripts and make clone of original Portal game.

    REQUIREMENTS
    Your object should have collider with rigidbody or CharacterController assigned to object.

    You should assign 4 system layers:
    8 - "SystemLayer"
    9 - "ClonedObject"
    10 - "Player"
    11 - "MoveObject"

    You should add 4 additional tags:
    "Player"
    "PlayerTemp"
    "Portal1"
    "Portal2"

    Go to Menu -> Edit -> Project Settings -> Physics, and set collision matrix:
    "SystemLayer" should NOT collide with "SystemLayer"
    "MoveObject" should collide with "SystemLayer"
    "ClonedObject" should collide with "SystemLayer"
    "MoveObject" should collide with "ClonedObject"

    Assign object to "MoveObject" (11) Layer. Now his collider will interact with teleport.
    Assign CharacterController to "Player" (10) Layer and his tag set to "PlayerTemp". Now his controller will interact with teleport.

    HOW TO USE PORTALS

    1) Add both portals from prefab folder on your Scene. (PortalizerResources->Prefabs->PortalX (X mean 1 or 2))
    2) Make portal as child of wall, if you want to pretend colliding of objects with it.
    3) Set Portal's transform.position.y = 0. Now portal is exactly on the wall.
    4) Go to "Portal X->Active->PortalView(Script)->SecondPortal" variable and assign "other portal active area" to it. Repeat for another portal. (Look example scene)
    5) Go to "Portal X->InsideZone->PortalGoingThrough(Script)->OtherPortal" variable and assign whole "other portal" to it. Repeat for another portal. (Look example scene)

    Now your portals connected, and can easy teleport objects with colliders.

    HOW TO MAKE CHARACTERCONTROLLER WORK?

    Teleporting of CharacterController(CC) is tricky, and should be scripted manually. The main problem is that CC always much more complex and unique than simple object. It has many scripts and other features (cameras, prefabs e.t.c.) that could differ from game to game, and can not be cloned as is. Usually you would need to clone only some visual parts of CC.

    Difference between Objects and CC in teleporting process:
    Object : Clone of object would became an original object, and original object would became a clone
    CC : Clone and CC will be swapped (switched their places and rotations). It is only illusion of teleporting.

    To make it work, you should modify my template => "PortalizerResources->Scripts->ModifiedFpsScript.js". Use "ModifiedObjectScript.js" script as example.

    SHADERS

    All object materials should be based on "Self-Illum/Bumped Specular" Shader. Custom shaders not ready yet, but i am working on it.

    How to make Custom Masked Shader?

    When object placed into the teleport, his shader replaced with '"Portlal/Masked/" + Shader.name + " Portal X"' name of shader.

    If you want to make your own custom masked shader for portal, you should follow next few steps: (for example we "creating" masked shader for standard "Diffuse" shader)

    1) Go to the "PortalizerResources->Shaders->Mask" folder and take TemplateShader.shader. This shader was written by Aras (link on thread http://forum.unity3d.com/threads/11832-Shader-for-Clipping-plane)
    2) Modify it and make 2 copies with Shader names "Portlal/Masked/Diffuse Portal 1" and "Portlal/Masked/Diffuse Portal 2". The most important in this scripts, is their names, and _ClipTextureMatrix variable, that should be named as _ClipTextureMatrix_Portal_1 (for Portal 1) and _ClipTextureMatrix_Portal_2 (for Portal 2). As example, look into my MaskIllumBumSpec1.shader and MaskIllumBumSpec2.shader.

    FAQ

    Q.: Object do not want teleport through portal. It is collide with wall, where portal placed
    A.: For object: check his layer. It should be "MoveObject". Also object should has collider and rigidbody. For CharacterController: his layer should be "Player" and tagged as "PlayerTemp"

    Q.: Why CharacterController do not teleported using default scripts?
    A.: CC always much more complex than simple object. It has many scripts and other features that could differ from game to game, and can not be cloned as is. Usually you would clone only some visual parts of CC

    Q.: Box has been stuck in the teleport or it is teleported partially
    A.: It is looks like box hit some collider behind the portal. This package used for visual part only.

    Q.: Where i could get masked shaders that will properly work with my object materials?
    A.: Package will be updated as soon, as new shaders will be done. Also you can write your custom shaders

    Q.: Is this iOS compatible?
    A.: Yes, i check it on iPad. The only thing is needed, is to rewrite mask shader (now it is don't cut objects)

    Q.: My object slowdown before teleporting.
    A.: Your object move too fast. You could make Inside zone larger to make trigger work like needed.

    Q.: Where is inner portal bounds?
    A.: You can add them manually. For example use 4 invisible boxes.

    Q.: After deploying on Web, masked shader became pink. What to do?
    A.: Unity don't want upload shaders and materials, which are not used on any of scenes (optimization). So you should add empty scene, with cubes that used masked materials, and add this EmptyScene it to "Scenes in Build" list.

    Q.: Where this Portalizer could be helpful?
    A.: You can use it in complex scenes, where you don't want to make holes but they are needed (for example in terrains for buildings or caves). You could connect few locations. You could make very nice "eye candy" portals from one part of map to another (for example in RPG). You could use it for simple objects teleporting in games like RollABall or so. You could use it for some physics based games. Finally you could modify scripts and make clone of original Portal game.

    CONTACTS

    For any questions you could PM me or discuss it in this thread. Email: thegeekgames@gmail.com

    You can get this package for FREE:

    1) You will help me with a couple of customized shaders for default shaders such as "SelfIllum Bumped Specular Shader", "Diffuse shader", "SelfIllum Specular Shader" and other (changes goes to all). Details in this thread (package from Aras).
    2) You will help me with a couple of customized shaders for iOS (changes goes to all). Details in this thread (package from Aras).
     
    Last edited: Jul 5, 2012
  2. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    The portal runs on my iPad but when my object enters portal A it suddenly pushes the object away at great speed in the Y axis.. My object is a simple sphere with rigidbody collider.

    note: I am trying to create the portal using a Vuforia Augmented Reality camera. Normally my unity3d scenes load with no problem.

    Is there anyway to adjust the camera so it will work with the Portalizer system ?
     
    Last edited: Apr 7, 2013
  3. ChuckB

    ChuckB

    Joined:
    May 3, 2013
    Posts:
    2
    Am I reading things correctly that a character controller isn't going to work out of the box? That's a deal breaker for me, as I'm an artist and the asset store is my friend for code. I need things to be smooth like the Ultimate FPS system, which has nice plug and play options. I'm working with an Oculus Rift project and need to be able to walk right through the portals I place on the wall.

    Can anyone confirm that this tool will work out of the box for just placing portals and walking through them? Thanks much!
     
  4. Kombiice

    Kombiice

    Joined:
    Jan 20, 2015
    Posts:
    64
    What happened?
     
  5. StevEE404

    StevEE404

    Joined:
    Jan 4, 2023
    Posts:
    1
    idk