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 Kruga · Aug 03, 2010 at 06:33 AM · positionchangeitween

ITween and Unity Postions.

Hi there,

I'm trying to get the camera to move from one position to another position. I'm using Itween to do this action.

What I want to Happen is :

  • Be able to retrieve the selected GameObject's.
  • Retrieve the Currently used camera.
  • Use ITween to Moveto the Selected GameObject's position.

That's it...

But what is currently happening is:

  • I Click on the Gameobject I want to move to. and get reference to it
  • I Get Reference to the camera's GameObject via Camera.Main.gameObject;
  • I Click a Move To button, and it starts to move to a random locaiton.

(not cool..)

So I set a Test Exception to throw when I want to start the move. So I can view the position of the selected GameObject.

Original Position of the GameObject is (-34351.24 , 4.752806 , 789.6055):Vector3,

Positions Shown by Exception Test are changing when I turn the camera with the mouse look.

  • Looking at where the game object is. = Exception: (0.1, 0.2, 28213.2):Vector3
  • Looking to the side a little bit is = Exception: (0.1, 0.2, 28213.2):vector3


Code from the GUI button

 if (GUI.Button(new Rect(160.0f,10.0f,100.0f,20.0f) , new GUIContent("Move To")))
        {
            cam = Camera.main.gameObject;
            throw new Exception(SelectedGameObject.transform.position.ToString());
            if (SelectedGameObject == null)
            {
                throw new Exception("Selected GameObject was not passed to GUI_selection");
            }
            else if (cam == null)
            {
                throw new Exception("Selected Camera was not passed to GUI_selection");
            }
            //Debug.Log(cam.ToString());
            //iTween.lookTo(cam, 7, null, SelectedGameObject.transform.position);
            iTween.moveTo(cam, 7, null, SelectedGameObject.transform.position, iTween.EasingType.easeInCubic);
            //iTween.moveToUpdate(cam, 7.0f, SelectedGameObject.transform.position, iTween.AxisType.y);
        }


So, Why is the position returning a random position. It should not change at all, Because it's not moving...

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Kruga · Aug 06, 2010 at 05:48 AM

I worked I was creating spheres and other object within the script. I assumed that the transform of the script would also be pointing at the sphere, or what ever object I had 'created' in the script. Which dose not seem to be the case. So instead of this :this.Transform = newPosition it should have been sphere.Transform. It's a little confusing, but seems to have corrected the problem...

The script seems to move up and down the world area. but the object created with in that script, is the correct position that you are looking for, and does not move.

Regards.

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

No one has followed this question yet.

Related Questions

throwing a ball camera position changes 0 Answers

Cannot rotate an object around the center 5 Answers

Change player's y-position for a specific animation 1 Answer

Animated object changes position when animation is played. 1 Answer

Player GameObject changes position when I start the game 4 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