Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 radler470 · Dec 04, 2014 at 05:00 PM · play-mode

Character snapping to new position upon "play."

Just to preface this question, I'm extremely new to Unity, so this may not sound like the most intelligent question ever. Anyway.

I have a 7 characters in my scene, lined up side by side. They are using the same Avatar and Character controller script. Everything is identical except the fact that I am using two different meshes. When I hit the play button, one of the meshes snaps down beneath the ground plane for it's starting position, yet in the Scene window is positioned correctly. Does anyone happen to know why this is, or where to look? They have the exact same pivot points and their rigs are identical.

Thanks so much.

Comment
Add comment · Show 5
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 theLucre · Dec 04, 2014 at 05:08 PM 0
Share

Are there any scripts attached to your objects?

avatar image BilboStabbins · Dec 04, 2014 at 06:15 PM 0
Share

Unlikely but you never know - make sure none of its colliders are intersecting with the ones on either side before you play the scene.

avatar image radler470 · Dec 04, 2014 at 06:29 PM 0
Share

Colliders are not intersecting, but thank you nonetheless for that.

I do have a script applied to it. Ugh, I wish I understood this better. This is a scene that I have inherited from someone else, and I am trying to change it around to use for a different activity. This is what the script looks like. I do not have a scripting background, so bare with me please. (removed variables introduction to reduce character count). HERE IS THE SCRIPT

script.txt (2.6 kB)
avatar image gamegirl1984 · Dec 04, 2014 at 08:13 PM 0
Share

Can you please post your script here on the page using the "code sample" button?? Just type it in and select it then press Ctrl+k and it will format it right. I can't open that file from my office computer.

avatar image radler470 · Dec 04, 2014 at 08:23 PM 0
Share

Let's see if this works...

 #pragma strict
 var theDwarf : GameObject;
 var detect : detector;
 var scriptHolder : GameObject;
 var nowActive : boolean;
 var activeNow : String;
 var intersecting : boolean;
 var lookAtPoint : Vector3;
 var dwarfSelected : boolean;
 var markedCorrect : boolean;
 var whereAmI : GameObject;
 var isPivoted : boolean;
 var isPivoted2 : boolean;
 var pivot : Vector3;
 var entrance : Vector3;
 var hidingPlace : Vector3;
 var shortName : String;
 var startingPointPos : Vector3;
 var startingPointRot : Quaternion;
 
 function Start(){
     scriptHolder = GameObject.Find("00-scripts");
     detect = scriptHolder.GetComponent(detector);
     lookAtPoint = Camera.main.transform.position;
     lookAtPoint.y = 0.0;
     pivot = GameObject.Find("pivot").transform.position;
     entrance = GameObject.Find("Entrance").transform.position;
     hidingPlace = GameObject.Find("Hiding Place").transform.position;
     theDwarf = gameObject;
     startingPointPos = gameObject.transform.position;
     startingPointRot = gameObject.transform.rotation;
 }
 
 function On$$anonymous$$ouseDown(){
     if (!detect.is$$anonymous$$oving)
     {
         detect.cutAckAnim = true;
         detect.activeDwarf = null;
         detect.activeSlot = null;
         nowActive = false;
     }    
 }
 function On$$anonymous$$ouseUp () {
     if (!detect.is$$anonymous$$oving)
     {
         detect.cutAckAnim = false;
         detect.activeDwarf = theDwarf;
         nowActive = true;
         detect.activeNow = gameObject.name;
         theDwarf.transform.LookAt(lookAtPoint);
         dwarfSelected = true;
         shortName = theDwarf.name.Substring(0, theDwarf.name.length-6);
         detect.shortName = shortName;
     }
 }
 
 function Update()
 {
     if (detect.goingTo$$anonymous$$ovies && !isPivoted)
     {
         theDwarf.transform.LookAt(pivot);
         theDwarf.transform.position = Vector3.$$anonymous$$oveTowards(theDwarf.transform.position, pivot, Time.deltaTime * detect.speed);
         if (theDwarf.transform.position == pivot)
         {
             isPivoted = true;
         }
     }
     else if (detect.goingTo$$anonymous$$ovies && isPivoted && !isPivoted2)
     {
         theDwarf.transform.LookAt(entrance);
         theDwarf.transform.position = Vector3.$$anonymous$$oveTowards(theDwarf.transform.position, entrance, Time.deltaTime * detect.speed);
         if (theDwarf.transform.position == entrance)
         {
             isPivoted2 = true;
         }
     }
     if (isPivoted && isPivoted2)
     {
         theDwarf.transform.LookAt(hidingPlace);
         theDwarf.transform.position = Vector3.$$anonymous$$oveTowards(theDwarf.transform.position, hidingPlace, Time.deltaTime * detect.speed);
     }
     if (theDwarf.transform.position == hidingPlace)
     {
         detect.areDwarvesInside = true;
     }
     if (detect.isReset)
     {
         gameObject.transform.position = startingPointPos;
         gameObject.transform.rotation = startingPointRot;
     }
 }

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I keep the game objects when I quit play mode? 1 Answer

Memory Leak in Play Mode 1 Answer

Objects in Play mode to Scene View 1 Answer

When i press play it just pauses right after. 6 Answers

Is there a way to know that Unity is quiting Play mode? 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