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 G.G. · Feb 28, 2013 at 09:54 PM · itweenpathorienttopath

ITween orienttopath x-y-z?

I have an object that need to follow a path 3D (change x-z but also y coordinates) into an inclined plane (45 degreee) + plane terrain (0 degrees) and another climb plane (30° degrees).

If i use the orienttopath, the object rotate for the x-z plane to follow curves od the path, but it is not alligned at inclined planes (y coordinate).

How can I solve this problem? (gravity?)

Comment
Add comment · Show 2
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 robertbu · Mar 01, 2013 at 06:00 AM 0
Share

Does the path follow the incline plane and the climb plane? If it does, the forward vector should be following the path up the planes. If you need to have the game object operate independently in some respects, you can place an empty game object on the path and make your visible game object a child. Then you can use localRotation and localPosition to have some independent movement while still following the path.

avatar image G.G. · Mar 02, 2013 at 02:05 PM 0
Share

Ok, have see that the object that follow path is solid if first person collide with it, and not solid if it collide other objec in game.

Also with an inclined path (different Y for differents waypoint) the object with orienttopath dont rotate and stay into initial alngle.

See this example: 2 simple plain (0 degrees) connected with 2 climb plane (30 degrees). Path with different quotes. Gameobject a cube.

The cube start into a 0 degrees plan and... "orient to path" on the curves of the x-z plan. But on the x-y plan you can see that the up-face of cube stay with 0 degrees (not change into 30°).

up and down of the img you can see the 0 degress plane connected with 2 middle 30° plane http://oi46.tinypic.com/2a9uuy0.jpg

upper face of the cube is plane and aligned with 0° degrees plane where start the movement http://oi50.tinypic.com/34y9xxz.jpg

Similary if you start the cube on inclined plane (es: 30°) on the 0 degrees plan the cube stay inclined...

orienttopath does not orient on y change of the path...

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Mar 02, 2013 at 04:12 PM

It's been awhile since I've used iTween, but the behavior seems strange...like there is something else going on here. But let's assume you are right about iTweens behavior. One solution is to use iTween.PutOnPath() and iTween.PointOnPath(). You would need to create your own timer and manage the percentage yourself. For looking along the path, use PointOnPath() to pick a point with a slightly higher percentage and use Transform.LookAt() to look at that point.

If this also doesn't work, then you'll know that the issue is not iTween...that something else in your code is impacting the rotation.

Comment
Add comment · Show 5 · 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 G.G. · Mar 08, 2013 at 12:32 AM 0
Share

nice idea, but this boring with more gameoject. We have 2 possible behavior: 1) example man that climbing stairs: he stay vertical, parallel to axys Y and notorthogonal to the ramp. 2) example car that climbing street in mountain: he stay orthogonal to the street plane with an angle respect y axys.

Now, i hope that they make itween only for the (1) case.

I have try also with 3 path and 2 rotate by. moveto path work also if the game object dont is at the start of the path. For this with more path we can make a script with: itween moveto path (path 1) itween totate by (30°) itween moveto path (path 2) itween totate by (-30°) itween moveto path (path 3)

Result? x-y-z work... but the cube take also a strange torque moment and rotate on y and z axys (double rotation) (^_^)'''

avatar image robertbu · Mar 08, 2013 at 01:30 AM 0
Share

If you set "orienttopath" to true, then it follows like example 2. If you do not set this parameter, then it follows the path like exmaple 1.

avatar image G.G. · Mar 08, 2013 at 09:13 AM 0
Share

Orienttopath true - follow example 1. itween orient front of fameobject with path on x-z plane. Not X-Y plane or Z-Y plane.

Orienttopath false - no rotation itween move the gameoject follow the path, but this dont rotate to have the front tangenti with path

Into a 3D space we have 3 point to have a position and 3 angle to have a front direction In fact need takes only 2 angle with orientToPath.... at moment itween probably take only 1 angle, that on the plane x-z. Now, if i need a gameobject that orient only on x-z plane (i push y axys, see the map from upside), i have the point position and 1 single rotation to make that front of gameobject was orthogonal to te tangent line of path. If i need a gameobject that orient into a 3D world, i need the x-y muvement and rotation, but also the z-y rotation (z local axys orthogonal at gameobject). The two behaviors can be stacked.

Example 1: man that follow stair do not need a y-z rotation to have front orient with x-y-z path. Example 2: car that follow climb plane need a y-z rotation to have front orient with x-y-z path.

it is simply geometry ^_^

avatar image robertbu · Mar 08, 2013 at 03:40 PM 0
Share

We are back to my original suggestion. I don't see any way to do alignment on only 2 axes with the provided iTween API. In particular, the API doesn't provide a way to see what percentage a game object is along the path. All it takes to make PutOnPath() and PointOnPath() work is to implement a timer on a script attached to each game object.

If you implement this way, to get it to align, calculate the look at point as I indicated above, then move the point (typically to match either x,y,z of the moving object). Then execute the LookAt().

avatar image G.G. · Mar 09, 2013 at 10:52 AM 0
Share

thanks for the help ^_^

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

iTween change orienttopath mid path? 0 Answers

[SCREENSHOTS] itween Path, orientToPath and gameObject rotation, 2D game 3 Answers

Using Itween with Unity 2D, sprite flips over while using orienttopath 1 Answer

iTweens MoveTo and "path" property 7 Answers

iTween MoveTo "Convoy" 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