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 SrBilyon · Oct 14, 2010 at 06:52 PM · rotation2d-platformeritweenwaypointspline

iTween and 2D Platforming Tutorial Merge: Rotation of player and camera needed

I'm to work on a 2.5D game, as my previous question states. I have my player moving moving a path using iTween, however, I can't seem to get the rotation of the player's mesh and the rotation of the camera to work quite right. alt text

function OnGUI () { value = value + Input.GetAxis("Horizontal") * speed * Time.deltaTime; iTween.PutOnPath(gameObject,path,value);}

//You can cause the object to orient to its path by calculating a spot slightly ahead on the path for a look at target: transform.LookAt(iTween.PointOnPath(path,value+.05));

}

I am using the PlatformerController script that was from the 2D Platformer tutorial as my base. I modified it on line here to allow the spline movement to work (rather, I comment the second line out:

function FixedUpdate () {
// Make sure we are absolutely always in the 2D plane.
//transform.position.z = 0;

This part right here is currently allowing the player to rotate to the direction he is going:

transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (movement.direction), Time.deltaTime * movement.rotationSmoothing);

I believe that the rotation code from the spline and the rotation line in the PlatformerController may be affecting each other. I need the rotation of the player rotate towards the next way point. Thanks!

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 DarkSepho · Mar 25, 2011 at 05:55 AM 2
Share

nice picture :)

1 Reply

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

Answer by pixelplacement · Oct 17, 2010 at 05:07 AM

Just put an example together on the support site for iTween that I hope helps out with this. If you parent the camera to the character in this example and offset it from its right shoulder you will be able to have a camera that follows around curves. Hope it helps: http://itween.pixelplacement.com/examples.php

Comment
Add comment · Show 3 · 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 SrBilyon · Oct 17, 2010 at 05:25 AM 0
Share

You are my best friend now.

avatar image SrBilyon · Oct 17, 2010 at 05:35 AM 0
Share

I bought the example, but it says that the seller hasn't uploaded it yet... :(

avatar image pixelplacement · Oct 18, 2010 at 02:58 PM 0
Share

Sorry about that. I uploaded it as soon as I saw that I forgot it. Did you get it?

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

Restrict a player's movement to a path for a 2.5D game that has curved paths 6 Answers

Make UI compass point to 3D object 4 Answers

Rotate around, but track the mouse 1 Answer

2D Security Camera detection 0 Answers

Unity 2D Sprite position mirror on character 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