Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 N1warhead · Oct 06, 2014 at 06:24 AM · camerateleportcam

Camera Transform.Position (teleport)

Hey guys, I am have my player practically ("Teleporting) into an Interior Scene. (like Zelda games)

That works fine and dandy. But the way I have it is, I just stuck the interior scene UNDER the terrain, under the building, (If there is a better way let me know)

However, when I hit the trigger to go back UP to the ground, I have the Smooth Follow script on it, so even when I re-enable the Smooth Follow script, it still smoothly transitions from Underground to the top, is there a way to just have it teleport back up?

Here is my script for going back to the TOP of the ground.

 using UnityEngine;
 using System.Collections;
 
 public class BackToWorld : MonoBehaviour {
 
     //CAMERA VARIABLES
     public Camera Main; // THis is PLAYER CAMERA
     public Camera Secondary; // THIS IS THE CAMERA WE CHANGE TOO OR DISABLE.
     public GameObject SpawnPoint;
 
     
     void OnTriggerEnter(Collider col){
         if (col.gameObject.tag == "Player") {
             Secondary.enabled = false;
             Main.GetComponent<SmoothFollow>().enabled = false;
             col.gameObject.transform.position = SpawnPoint.transform.position;
             Main.GetComponent<SmoothFollow>().enabled = true;
             Main.enabled = true;
         }
     }
 }

I've even tried attaching a Parent empty to the Camera, but I've realized recently that Cameras are hard to work with when you try to get them to do something outside their norms of just floating around lol.

Any help be much appreciated, thanks guys!

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Tourist · Oct 06, 2014 at 07:09 AM

If you have a complex vast environnement (like Zelda games), I would recommend you to split to other scenes the interior and the exterior, at least for the dungeons.

For your problem, maybe when you teleport the player, get the Smooth script and tell it there was a teleportation.

Comment
Add comment · Show 1 · 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 N1warhead · Oct 06, 2014 at 07:23 AM 0
Share

I was honestly thinking about doing Scenes like that, just wasn't sure on how loading times would be for when the game got bigger. But from my tests and stuff, I have darn near instantaneous loading times for everything so far.

That maps aren't exactly like Zelda, they are more so like Banjo $$anonymous$$azooie, just didn't see a point in making the Interior a whole new scene, but I'm thinking that may be the best choice.

I have sort of found a hack towards it, I don't like doing what I have just done, but it does work.

I just made it into a Co-Routine for 1.5 seconds or something, then it reneables it, (screen fades black and back) kinda of thing. But I don't like doing that, in this case it's perfectly fine, however, on certain maps, what if an enemy is near? He can walk up and get you while transitioning lol. But I can prob fix that with a simple bool towards the health.

But thanks for the ideas, I'll definitely look into it buddy!

avatar image
0

Answer by FlamingVorpalCow · Oct 31, 2014 at 04:27 PM

Let me see i got it straight:

The problem is that the camera does a smooth transition from secondary camera to the main, and you expected to switch from one to the other without smoothing, right?

maybe you can make the smothing ocurr with a 1 frame delay, after you have sitched cameras:

On the on triggerEnter() remove the enabling of the SmoothFollow component, and create a flag set to true; on update make a check, if (flag), enable the SmoothFollow Component.

that way you don't get delay or that black screen, and the follow is there from the get go, but right after you started rendering with the main camera.

Hope this helps...

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.

Follow this Question

Answers Answers and Comments

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity3d or Maya-style Camera navigation 5 Answers

After using NGUI, game is not scaling for different devices ??? 0 Answers

How can I make a character disappear from view from one side to the other? 1 Answer

Raycast From Camera to Object 1 Answer

How can I program a 'wrap-screen'? 2 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