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

Using iTween.MoveTo() for paths in local space

$
0
0
Hi, I'm using iTween to create paths for objects but need them to be children of another object. As far as I'm aware, MoveTo() cannot be used in this way, or in prefabs, etc., so I was wondering if anyone knows of a fix or an alternative? I came across the following link on the Play Maker forum which claims to fix this bug ([http://hutonggames.com/playmakerforum/index.php?topic=160.0;prev_next=prev#new][1]). As I don't use PlayMaker I'm not sure whether this can be applied to the standalone version of iTween. I have pasted the script below but it looks quite different to the iTween scripts. Can anyone please let me know whether I can add or modify this to work? Many Thanks for any help you can provide. // (c) Copyright HutongGames, LLC 2010-2011. All rights reserved. using UnityEngine; namespace HutongGames.PlayMaker.Actions { [ActionCategory("iTween")] [Tooltip("Changes a GameObject's position over time to a supplied destination.")] public class iTweenMoveTo : iTweenFsmAction { [RequiredField] public FsmOwnerDefault gameObject; [Tooltip("Move To a transform position.")] public FsmGameObject transformPosition; [Tooltip("Position the GameObject will animate to. If Transform Position is defined this is used as a local offset.")] public FsmVector3 vectorPosition; [Tooltip("The time in seconds the animation will take to complete.")] public FsmFloat time; [Tooltip("The time in seconds the animation will wait before beginning.")] public FsmFloat delay; [Tooltip("Can be used instead of time to allow animation based on speed. When you define speed the time variable is ignored.")] public FsmFloat speed; [Tooltip("Whether to animate in local or world space.")] public Space space = Space.World; [Tooltip("The shape of the easing curve applied to the animation.")] public iTween.EaseType easeType = iTween.EaseType.linear; [Tooltip("The type of loop to apply once the animation has completed.")] public iTween.LoopType loopType = iTween.LoopType.none; [ActionSection("LookAt")] [Tooltip("Whether or not the GameObject will orient to its direction of travel. False by default.")] public FsmBool orientToPath; [Tooltip("A target object the GameObject will look at.")] public FsmGameObject lookAtObject; [Tooltip("A target position the GameObject will look at.")] public FsmVector3 lookAtVector; [Tooltip("The time in seconds the object will take to look at either the Look Target or Orient To Path. 0 by default")] public FsmFloat lookTime; [Tooltip("Restricts rotation to the supplied axis only.")] public iTweenFsmAction.AxisRestriction axis = iTweenFsmAction.AxisRestriction.none; [ActionSection("Path")] [Tooltip("Whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default.")] public FsmBool moveToPath; [Tooltip("How much of a percentage (from 0 to 1) to look ahead on a path to influence how strict Orient To Path is and how much the object will anticipate each curve.")] public FsmFloat lookAhead; [CompoundArray("Path Nodes", "Transform", "Vector")] [Tooltip("A list of objects to draw a Catmull-Rom spline through for a curved animation path.")] public FsmGameObject[] transforms; [Tooltip("A list of positions to draw a Catmull-Rom through for a curved animation path. If Transform is defined, this value is added as a local offset.")] public FsmVector3[] vectors; [Tooltip("Reverse the path so object moves from End to Start node.")] public FsmBool reverse; private Vector3[] tempVct3; public override void OnDrawGizmos(){ if(transforms.Length >= 2) { tempVct3 = new Vector3[transforms.Length]; for(int i = 0;i= 2) { tempVct3 = new Vector3[transforms.Length]; if(reverse.IsNone ? false : reverse.Value){ for(int i = 0;i

Viewing all articles
Browse latest Browse all 116

Trending Articles



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