Portables
What are Portables?
Portables are gameObjects that have a Portable script or any script that inherits from Portable attached. Portables work tightly together with the Portal script. They provide a Teleport function and handle entering and exiting the portal area.
You have following options of Portables:
Portable.cs
Stores the basic teleport functionality
PlayerController
PlayerController with simple move, rotate and teleport mechanism.
PlayerTeleporter.cs
Inherits from Portable.cs and handles adapting position and rotation on teleport, as well as syncing the Physics properties.
Can be used to attach to your own Character controller to enable the teleport feature
PortableRigidBody.cs
Also inherited from Portable.cs. Use this script for objects with rigidbodies
How do Portables work?
Portables are basically responsible to provide some basic helper functionality for teleporting, entering portal area and exiting the portal area, which will be called by the Portal script They are responsible for creating the clone when entering the portal area and keep track of all the materials.
How to create your own Portables?
You have a PortableObjRb prefab in the prefabs folder, which is a portable object that simply moves forward with a defined speed.
For creating your own portable, follow these steps:
Create a empty gameObject as the PortableHolder
If you want a rigid body object then attach the PortableRigidBody.cs to it (The rigidBody should be added automatically) Otherwise use the Portable.cs script
Add your model as a child object and drag it to the scripts portable object property
If you want proper slicing, make sure to use materials with the SF Slicing shader for your model. There is a Sliced Obj material in this asset, that you can use if you do not want to create a new one.
Add a Mesh Collider or any other collider that fits your model
Now your portable object is finished and you should be able to teleport it through the portals.
Last updated