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 DrunkGamer · Aug 14, 2013 at 09:59 PM · rotationpositionobjectfreezeblinking

Freeze object's position and rotation

Being more specific, i want to know how can i make an object (more specifically an statue model) freeze at it's current position and rotation when seen. I'm making an small project which is heavily based on the weeping angels and a little bit on slender (But it isn't the typical "Hurr durr get tah noutes bifor slender kills yah") and i need to have a script which freeze the angel (in it's actual animation, if possible) when the player sees it and unfreezes it when it's out of the camera's view.

Extra: Also I'm thinking about adding a "blinking system" as i like to call it, in which your character needs to blink every X seconds (Like in SCP containment breach) but from all the scripts i wrote, every single one of them failed.

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 zombience · Aug 14, 2013 at 10:06 PM

you can use the isVisible property of any renderer to check whether it is in view of the camera.

http://docs.unity3d.com/Documentation/ScriptReference/Renderer-isVisible.

 StatueScript statue;
 
     if (statue.gameObject.renderer.isVisible)
     {
         statue.FreezeMovement();
     }
 
Comment
Add comment · Show 2 · 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 DrunkGamer · Aug 14, 2013 at 10:08 PM 0
Share

Thx for the quick answer, I'm going to check out if it works.

avatar image zombience · Aug 14, 2013 at 10:57 PM 0
Share

no problem. in my example, I'm assu$$anonymous$$g you've made your own script to control the statues, and that you have some public method that can stop the movement portion of that script.

whether you set the rigidbody to kinematic, flip a bool so that transform position no longer gets updated, or whatever, that part is dependent on your script. I didn't attempt to write that here because it depends entirely on your coding.

avatar image
0

Answer by gogu23 · Aug 14, 2013 at 10:10 PM

Hallo :)

Well you can make an Emtygameobject and add a square Collider to it .. its and invisible collider.

And then you can make a script with IF statements like

 function OnTriggerEnter (other : Collider)
 {
    // Check for collsion 
    
    if(other.gameObject.tag == "Gametagofyourobject")
    
        {  
       Debug.Log("you did just collide and need to freese");

   
    }

And then in the if statement ..

you can look in the unity API after the transform class and see your options and then make a math.clamp ... i am sure you can figure something out that way

Hope this helps just a little

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 DrunkGamer · Aug 14, 2013 at 10:19 PM 0
Share

Thx for your answer too! I'm going to check it out also.

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

17 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

Related Questions

Return object to position 3 Answers

Add force at position with respect to rotation 1 Answer

set child object position when playing the animation 0 Answers

Move object A towards object B 2 Answers

Make object appear within camera view 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