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
1
Question by interactiveBoy · May 21, 2010 at 05:19 PM · cameratransformitween

Newbie trying iTween

Got iTween dragged into my project and I can see the code is executing when I hit play because the inspector shows the tweens going on...

What I'm trying to do:

I've got a scene created in Cinema 4D, with a few null objects placed for target landing spots for my camera. I eventually will have a clickable GUI element that will step through each of the landing places, and the camera should just tween over to each null's transform.

However, just to start scripting, I've made a simple script and attached to my camera as follows:

var thingToMove : GameObject; var stop1 : GameObject;

function Start () { iTween.rotateTo(thingToMove, {"transform.rotation":(stop1.transform.rotation), "time":3, "transition":"linear"}); iTween.moveTo(thingToMove, {"transform.position":(stop1.transform.position), "time":3, "transition":"linear"}); }

When I hit play, I can see that the script is executing, because the inspector view shows two tweens in process then they disappear. There are no errors, but the camera doesn't move (neither in game view or scene view)

I also tried by applying this to a game model instead of the camera, but still nothing.

I know this is super remedial, but I just need a kick in the right direction.

Thanks!

UPDATE

OK, so I got it working on position OR rotation, but not BOTH. Here's my updated code...why does it only do one tween? How can I do both?

var thingToMove : GameObject; var stop1 : Transform; private var transSpeed = 10;

function Start () { iTween.moveTo(thingToMove,{"position":Vector3(stop1.position.x, stop1.position.y, stop1.position.z), "time":transSpeed, "transition":"easeInOutExpo"}); iTween.rotateTo(thingToMove,{"rotation":Vector3(stop1.rotation.x, stop1.rotation.y, stop1.rotation.z), "time":transSpeed, "transition":"easeInOutExpo"}); }

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
3

Answer by interactiveBoy · May 21, 2010 at 07:28 PM

Solved!

Needed to read eulerAngles from the source object and apply that to the object I'm moving.

var thingToMove : GameObject; var stop1 : Transform; private var transSpeed = 3;

function Start () {

 iTween.rotateTo(thingToMove,{"rotation":Vector3(stop1.eulerAngles.x, stop1.eulerAngles.y, stop1.eulerAngles.z), "time":transSpeed, "transition":"easeInOutExpo"});
 iTween.moveTo(thingToMove,{"position":Vector3(stop1.position.x, stop1.position.y, stop1.position.z), "time":transSpeed, "transition":"easeInOutExpo"});

}

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
1

Answer by typane · Nov 30, 2012 at 08:57 AM

For those who want the C# solution:

 iTween.RotateTo(clickedObject, new Vector3(defaultRot.eulerAngles.x, defaultRot.eulerAngles.y, defaultRot.eulerAngles.z), moveTime);
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

1 Person is following this question.

avatar image

Related Questions

Smoothly Move camera while looking at object 0 Answers

How to make a script that imitates the parent-child transform lock ? 1 Answer

iTween's inaccuracy of final position 2 Answers

Quaternion Slerp Sanity Check 1 Answer

Moving camera with player in 2d 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