ggyanxin / hotween

Automatically exported from code.google.com/p/hotween
0 stars 0 forks source link

PlugVector3Path OrientToPath2D #72

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Daniele,

I will start developing a 2D game later this year and thought that a 2D 
compatible (Unity 4.3 sprites) version of the orient to path option would be 
really helpful. With the current orient to path behavior, the sprites are 
rotated to the path in 3D (+- 90°) and do not consider Unity's 2D view (x-y). 
I couldn't achieve the desired result when locking an axis.

Basically it could look like this:
https://dl.dropboxusercontent.com/u/61299629/sws/OrientToPath2D.PNG

I know you're a busy knight, so I'll just leave that here :)

Have a good one!

Original issue reported on code.google.com by baroniu...@gmail.com on 17 Apr 2014 at 11:34

GoogleCodeExporter commented 9 years ago
Ahhh that would indeed be a cool addition! Now I'm superbusy, but remember it 
to me later (before you need it for your 2D game), and I'll implement it :)

Original comment by daniele....@gmail.com on 18 Apr 2014 at 9:44

GoogleCodeExporter commented 9 years ago
This would be massively useful.  Or just a parameter for which axis to orient 
to the path.

Original comment by walkeras...@gmail.com on 26 Apr 2014 at 11:43

GoogleCodeExporter commented 9 years ago
About the orientation axis, you can already use the additional Method 
Paramenter LockAxis, and lock the Z axis to make paths work with Unity 2D :) By 
the way, Florian, can you tell me if you tried that? It seems it already solves 
everything.

Original comment by daniele....@gmail.com on 27 Apr 2014 at 4:10

GoogleCodeExporter commented 9 years ago
EDIT: sorry Florian, you already mentioned you tried. Will investigate it more 
when it will be time.

Original comment by daniele....@gmail.com on 27 Apr 2014 at 4:11

GoogleCodeExporter commented 9 years ago
Hi, I'm using HOTween and Simple Waypoint System in my 2.5D project and I have 
the same problem. A setting for the axis to rotate around would be perfect. 
Locking the z axis doesn´t do the trick, because the 2D colliders NEED to 
rotate around the z axis - locking it disables any rotation on that axis.
Anyway, thanks for your great plugin!

Original comment by Rene.Pl...@googlemail.com on 13 May 2014 at 9:39

GoogleCodeExporter commented 9 years ago
Hi again,

I now have a few users asking for this kind of 2D orienting thing too, it would 
be great if you could have a look at it in the coming weeks :) I've built a 
very simple scene (Unity 4.3.3) which demonstrates weird path rotations on 
sprites:

https://dl.dropboxusercontent.com/u/61299629/sws/OrientToPath2DRepro.unitypackag
e

Original comment by baroniu...@gmail.com on 1 Jun 2014 at 12:58

GoogleCodeExporter commented 9 years ago
Hi,
i'm in trouble with 2D orient to path feature too. 
I use  the Simple Waypoint System and it's a great addition to work but the 
flip at end of a path is a clearly unavoidable need to make game have a sense.
Please help.

Original comment by crysoft....@gmail.com on 5 Jun 2014 at 3:51

GoogleCodeExporter commented 9 years ago
I'm on it! Will start work on it tomorrow :)

Original comment by daniele....@gmail.com on 5 Jun 2014 at 4:15

GoogleCodeExporter commented 9 years ago
Great!! Thank you Daniele!

Original comment by crysoft....@gmail.com on 5 Jun 2014 at 10:30

GoogleCodeExporter commented 9 years ago
Voilà, this works with the test you sent me baronium. Please test it out and 
let me know if everything's ok :)

HOW IT WORKS
There's a new method parameter for PlugVector3Path, Is2D(). Chain it to the a 
PlugVector3Path in order to let HOTween know that the path must be calculated 
using 2D coordinates and rotation, like this:
PlugVector3Path plugPath = new PlugVector3Path(positions, true, 
Holoville.HOTween.PathType.Curved).Is2D();

Original comment by daniele....@gmail.com on 10 Jun 2014 at 12:07

Attachments:

GoogleCodeExporter commented 9 years ago
Tested with curved/linear, single/partial, closed paths and OrientToPath 
setting. Works like a charm :) Thank you very much for this!

Original comment by baroniu...@gmail.com on 10 Jun 2014 at 1:03

GoogleCodeExporter commented 9 years ago
Great! :) Gonna wait a couple days to be sure you don't encounter any new 
issues and then release. In the meantime you can pack that version in SWS, 
since it will be the one I'll push, if nothing happens. In case you prefer me 
to release sooner instead just let me know, I can do it quickly enough :)

Original comment by daniele....@gmail.com on 10 Jun 2014 at 1:23