Quantcast
Channel: Questions in topic: "moveto"
Viewing all articles
Browse latest Browse all 116

Using iTween to move a gameobject from node to node

$
0
0
Hello all, I am using the iTween path for a level select menu. I have the path nodes set up to the location of the level buttons. I have a user icon that I want to move from node to node when the level button is pressed. I've tried using the documentation and other forum posts but I wasn't getting anywhere fast! So, my user icon starts on level 1. When I click level 6 I want the user icon to travel the path of the iTweenPath until it gets to the sixth node(same location as the level 6 button). How can I accomplish that? I would post my code but its pointless b/c its very broken. I came close to what I want with this code but the user icon gameobject displayed very wierd behavior(usericon transporting around the scene). Before trying the .moveto() method I was using the .putonpath() which just teleported the usericon to the button location. It was great minus the fact it didn't walk there. Any suggestions?? If you need code I'll upload it but like I said before it really doesn't work at all. Also, I got the moveto to work but the usericon wouldn't move along the iTweenPath it would just pan from button location to button location Update 1: Ok, so I got close to what I want. iTween.MoveTo(userIcon.gameObject, iTween.Hash("position", new Vector3(worldPath.nodes[moveDestination].x, worldPath.nodes[moveDestination].y, 0.0f), "path", iTweenPath.GetPath("World0Path"), "movetopath", false, "time", 5.0f, "looptype", "pingPong")); This line of code moves the usericon along the path but it always moves it to the last node in the iTweenPath. I thought I could use the position parameter to be the end position but clearly I was wrong. Update 2: The iTween documentation says the position arg is supposed to be the "for a point in space the GameObject will animate to." With my line of code(still the one from above) no matter what I set the position arg to be it still always ends at the end of the iTweenPath http://itween.pixelplacement.com/documentation.php

Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>