• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by raffafreitas · Aug 23, 2014 at 06:45 PM · 3dworld

how do i make a pac-man like world? (as in, ground-sky connected)

the idea is simple: in a 3D environment, when you fall off the terrain, i want the player to keep falling down until the same terrain starts to show up again. you know what i mean! like in pac-man, where the right side of the screen goes to the left side. is it possible in unity? if so, is it easy or hard? i'm super new to this! i tried googling this question, but, i don't know how to properly describe what i mean, so i can't find anything...

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KEELAN · Aug 23, 2014 at 06:53 PM 0
Share

Hi, you could place a trigger below the terrain that checks for the player and when the player travels through it either move the player up (so that the terrain is stationary) or move the terrain down.

avatar image raffafreitas KEELAN · Aug 23, 2014 at 07:25 PM 0
Share

thanks for the answer, but i have no idea how to do that! like i said, i'm super new to this. do you think that would create the illusion of continuity, though?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Addyarb · Aug 23, 2014 at 07:39 PM

What you're going to want is a "teleport script" for this application. Create a new game object (A box most likely) and change the box collider to "trigger." Then add something like this to the box:

 using UnityEngine;
 
 public class Teleporter : MonoBehaviour
 {
     private Transform myTransform; // This is Pac Man's position. It will update as he moves.
     public GameObject newPosition; // This is where you can drag-and-drop the Game Object with the position you want Pac Man to go if he hits the trigger attached to this object. 
                                 // Presumably on the other side of the map.
     void Start(){
 
                 myTransform = GameObject.FindWithTag ("Player").transform.position;
                 
         }
     void OnTriggerEnter ( Collider other )
     {
         //if Pac Man enters this box's trigger
         myTransform = newPosition.transform.position;
         
 
     }
 
Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image raffafreitas · Aug 23, 2014 at 09:12 PM 0
Share

hmmm, okay, thank you! i think i understand. now, this code you sent me doesn't seem to be working, or i am doing something wrong. unity gives two errors:

Assets/Teleporter.cs(10,17): error CS0029: Cannot implicitly convert type UnityEngine.Vector3' to UnityEngine.Transform'

Assets/Teleporter.cs(16,17): error CS0029: Cannot implicitly convert type UnityEngine.Vector3' to UnityEngine.Transform'

avatar image KEELAN · Aug 23, 2014 at 09:17 PM 0
Share

the code should be

line 10 myTransform = GameObject.FindWithTag ("Player").transform;

and then line 16 myTransform.postion = newPosition.transform.position;

avatar image raffafreitas · Aug 23, 2014 at 09:36 PM 0
Share

okay... i've done everything, set up the cube, the transport gameobject, the "is trigger" button. now it compiles, but it doens't work and this error seems to be happening...

NullReferenceException: Object reference not set to an instance of an object Teleporter.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Teleporter.cs:16)

NullReferenceException: Object reference not set to an instance of an object Teleporter.Start () (at Assets/Teleporter.cs:10)

avatar image KEELAN · Aug 23, 2014 at 09:40 PM 0
Share

check the package below. it works

avatar image raffafreitas · Aug 23, 2014 at 09:46 PM 0
Share

oh! right! i got distracted trying to get that code to work and didn't even see yours. it does work! thank you so much :)

Show more comments
avatar image
0

Answer by KEELAN · Aug 23, 2014 at 08:09 PM

Put a cube underneath the level, then add a boxcollider onto that. Set the collider as a trigger. then in a script use the funtion (written in psuedo code)

void OnTriggerEnter() { playerPosition = moveUp; }

you should watch some tutorials http://unity3d.com/learn/tutorials/modules/beginner/physics/colliders-as-triggers

if the player is moved up by say 1000 units in one frame, he/she wont notice the difference (unless while under the level they can look up and see it, then it would disappear)

made a quick package here for you https://www.dropbox.com/s/8rjzhcrhwavipr2/levelFall.unitypackage?dl=0

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

GUI in 3D world space "Monitors / Screens / Displays" 1 Answer

Fix a GUI's position relative to a 3D object 1 Answer

How to transfer the world from Maincraft to Unity 1 Answer

Creating a World? 2 Answers

Can i create a virtual globe in unity? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges