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 /
This question was closed Aug 03, 2014 at 12:41 PM by meat5000 for the following reason:

Other

avatar image
0
Question by seb-lopez · Jun 07, 2014 at 01:54 PM · animationdoorduplicate

multiplying door problem!!

hello , i made a door ( in blender) and i animated in unity i done a script and it work perfectly but when i want to duplicate it the second door moves position where my first door is. and i don't know if its the methode or the script problem. here the script in case.

 var Target : GameObject;
     
     function Start () {
     
     }
     function OnTriggerEnter ( player : Collider ){
     
     if ( player.tag == "Player"){
     
     GameObject.Find( "door").animation.Play ( "openD" );
     
     }
     }
     
     
     function OnTriggerExit ( player : Collider ){
     if ( player.tag == "Player"){
     yield WaitForSeconds (3);
     GameObject.Find( "door").animation.Play ( "closeD" );
     }
     }
     
     
 
Comment
Add comment · Show 1
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 meat5000 ♦ · Aug 03, 2014 at 12:40 PM 0
Share

Is the above script intended to be on the door? There's no need at all to use GameObject.Find.

2 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by seb-lopez · Aug 03, 2014 at 12:37 PM

well at the end i made a model in blender made it own animation and it worked better. thank you anyways.

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 dsada · Jun 07, 2014 at 02:28 PM

my best guess is you have the same problem that this guy had:

http://forum.unity3d.com/threads/animation-position-jump.26943/

EDIT: I edited the link, because that not that i wanted to link

Comment
Add comment · Show 4 · 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 seb-lopez · Jun 14, 2014 at 11:13 PM 0
Share

hmm didn't help me , but what i don't understand why it won't animate in a fix position. i was thinking to change the script , ins$$anonymous$$d of having animation, it when it enter's the trigger the gameobject will go up with scripting but i don't know how to do it besides animation =(

avatar image dsada · Jun 15, 2014 at 06:39 AM 0
Share

The reason is when you create an animation inside unity you actually give its position,rotation,scale in every frame. So even if you move it away, the first frame will move the object back to the place that you added while creatin the animation.

The biggest problem, that you cant say to this position to be relative like: let the position be current position + 5 unit.

But a great workaround is to make the object (in your case the door) as a child of an other gameobject and the position,rotation,scale will be relative to the parent object.

After this do NOT move the door to the desired position, but move the parent object to a position where you can see the door is at the right position. But you need think about your animation. If your door hasn't got the same transform datas as your animation's first frame it is going to jump there.

I am still pretty sure this is your problem, maybe you didnt understand the linked post enough. So please try it one more time, I am sure this gonna fix it :)

avatar image seb-lopez · Jul 02, 2014 at 01:34 PM 0
Share

ok so i should make a empty game object on the moving door part and animate it? ( thanks for explain my problem =) )

avatar image dsada · Jul 02, 2014 at 04:38 PM 0
Share

I recommend to redo your animation. I mean first make you object's parent an empty gameobject then start doing your animation and it should be fine. $$anonymous$$ake sure your objects position is 0,0,0 in the first frame. And if you want to move your door, move the parent object ins$$anonymous$$d of the door

Follow this Question

Answers Answers and Comments

23 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

Related Questions

Trouble with Animation 0 Answers

Trigger door animation with external trigger 1 Answer

Character goes into unwanted state. 0 Answers

FPSController Collision with moving objects 2 Answers

Object gone aftar play - Animation problem. 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