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 una_x · Dec 31, 2013 at 02:25 PM · cameramovefreezelock

How to Freeze move camera

How to write script that performs freeze camera (X and Y) when player enter in trigger but without using Time.timeScale.

I tried with:

 var mLook : MouseLook ;
 mLook = other.GetComponent(MouseLook);
 mLook.enabled = false;

but this freeze when a player recently move mouse and not in the position in which I wanted to.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by deltamish · Dec 31, 2013 at 03:01 PM

Well Thats QuiteSimple

Try caching the position first and then apply it to its position

 private var _CurrentPos:Vector3;
 
 function OnTriggerEnter(col:Collider) 
 {
 if(col.tag == "Player")//
 {
 if(_CurrentPos == Vector3.zero)
 _CurrentPos = col.transform.position;
 
 col.transform.position = new Vector3(_CurrentPos.x,_CurrentPos.y,col.transform.position.z);
 
 }
 
 }
 
 
 //Resetting the _CurrentPos
 function OnTriggerExit(col:Collider)
 {
 if(col.tag == "Player")
 {
 _CurrentPos = Vector3.zero;
 }
 }
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
avatar image
0

Answer by una_x · Dec 31, 2013 at 05:44 PM

Thank you. I have one question how this script add additional rotation? because this is only position X,Y,Z

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 deltamish · Dec 31, 2013 at 07:07 PM 0
Share

please use coment box to post something other than answer and what do you mean by

add additional rotation

avatar image
0

Answer by slackz · Mar 10, 2018 at 07:33 PM

Okay, I was playing around with diff options and the dead simplest for me which worked out was simply having a gameManager type script catch pause events, set a simple static variable for that game pause state, and then check for that in your player / camera movement sections. Just don't move player and camera when game state is paused.

My scenario is simple enough not to mess with all sorts of prefabs, etc.
For my needs I needed my dialogue boxes and menus to continue animating, but not having player/camera movement interfere. This worked out swimmingly and feels like the path of least resistance at this point :)

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

20 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

Related Questions

Camera freezes while moving, game is not locked up. 0 Answers

How to make your character move? 7 Answers

How do I lock Y Axis movement for Parented Camera? 3 Answers

How to make camera position relative to a specific target. 1 Answer

button click to move camera to another position 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