Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.3k stars 346 forks source link

Path isn't moved / rotated with the attached object #127

Open Nitaym opened 7 years ago

Nitaym commented 7 years ago

I have an object with a DOTween path. This object is being rotated in the game, but the path stays in it's original position. Moreover, my game is implemented with an arena that moves and rotates around the user. The GOs are children of the arena therefore rotate with it - The DOTween path, however does not move / rotate at all.

(I'm sorry if there's a feature for that but I couldn't find one in the documentation)

Nitaym commented 7 years ago

I've tried to rotate the waypoints manually with this code:

                var tweenPaths = obj.GetComponentsInChildren<DG.Tweening.DOTweenPath>();
                if (tweenPaths.Length > 0)
                {
                    foreach (var path in tweenPaths)
                    {
                        List<Vector3> waypoints = path.wps;
                        List<Vector3> rotatedWaypoints = new List<Vector3>();
                        foreach (Vector3 waypoint in waypoints)
                        {
                            Vector3 rotatedWaypoint = Utils.RotateAroundPoint(Vector3.zero, waypoint, angle);
                            rotatedWaypoints.Add(rotatedWaypoint);
                        }

                        path.wps = rotatedWaypoints;
                    }
                }

But all waypoints in path.wps were {0, 0, 0}