- Home /
iTween - Traveling around a cylinder
I want to travel a flying object around a cylinder along a set path. iTween looks awesome and I'd like to use it to get a really smooth path. If I use iTween's path system, can I keep the player's local y axis relative to the center of the cylinder? So that "down is always towards the cylinder.
Answer by robertbu · Mar 04, 2014 at 06:38 AM
If all you want to do is rotate around a cylinder, then coding it directly (rather than iTween), will generate a smooth path in very few lines of code. If this path is part of a larger path that you need iTween's path system to follow, then consider using iTween.PutOnPath(), and/or iTween.PointOnPath(). These two functions allow you to move an object along the path but still maintain control of position and rotation. This will allow you to easily keep your 'down is always towards the cylinder' orientation.
I want to use the full capabilities of iTweens. $$anonymous$$y path includes swiping down, up and going side to side. I just want to set the up to the opposite direction of the cylinder at all times. So I'm going to use the iTween.PutOnPath() combined with Quaternion.LookRotation() and Quaternion.Slerp() could give it a a really smooth look. Any comments before I give that a go.
Answer by Hassan-Ali · Mar 04, 2014 at 07:43 AM
you can simply use transform,RotateAround to move flying object around a cylinder.
function Update() {
// Spin the object around the world origin at 20 degrees/second.
transform.RotateAround (Vector3.zero, Vector3.up, 20 * Time.deltaTime);
}
Your answer
Follow this Question
Related Questions
Tweening the walk of a NPC with charactercollider 1 Answer
Move one waypoint on iTween 1 Answer
iTween : Move Just a Small Portion of a Path? 2 Answers
iTween - Path Movement by Touch 0 Answers
Moving Over Terrain with iTween 1 Answer