Playmaker Forum
Bug Reporting => PlayMaker Bug Reporting => Topic started by: Proton on July 22, 2011, 01:51:51 AM
-
Reproduction Steps
1. Add iTweenMoveTo action to a child game object
2. Setup the action to animate for a few seconds
3. Make sure the action's 'Space' = 'Self'
4. Run program
5. Drag the parent game object around the scene
Expected Behavior
The animated child continues to move with the parent since it should only animate in local space.
Actual Behavior
The child animates in world space and does not get dragged with the parent.
iTweenMoveTo.cs
Line 129
hash.Add("space", space);
hash.Add("islocal", space == Space.Self );
Based on iTween documentation. Seems like sometimes they use 'space', other times 'islocal'.
http://itween.pixelplacement.com/documentation.php#MoveTo
iTweenMoveTo.cs
Line 153
else tempVct3[tempVct3.Length - 1 - i] = transforms.Value.transform.position + (vectors.IsNone ? Vector3.zero : vectors.Value);
else tempVct3[tempVct3.Length - 1 - i] = (space == Space.World ? transforms.Value.transform.position : transforms.Value.transform.localPosition) + (vectors.IsNone ? Vector3.zero : vectors.Value);
Line 161 (For the non-reversed path)
else tempVct3[tempVct3.Length - 1 - i] = transforms.Value.transform.position + (vectors.IsNone ? Vector3.zero : vectors.Value);
else tempVct3[tempVct3.Length - 1 - i] = (space == Space.World ? transforms.Value.transform.position : transforms.Value.transform.localPosition) + (vectors.IsNone ? Vector3.zero : vectors.Value);
The following classes should also use 'islocal' instead of 'space':
iTweenMoveFrom.cs
iTweenMoveUpdate.cs
iTweenRotateFrom.cs
iTweenRotateTo.cs
iTweenRotateUpdate.cs
Edit: One other thing, 'Move To Path' = true does not work when Space = Self. I think it might be an iTween bug though, not sure. The first path node it generates seems to be in world space.
-
Thanks for the bug report - and fix!
-
I just realized that for the path & target nodes we can't just use their localPosition since they might not have the same parent as the original GameObject.
So it might need to look something like this:
pos = space == Space.World ? transformPosition.Value.transform.position + pos : go.transform.parent.InverseTransformPoint(transformPosition.Value.transform.position) + pos ;
else tempVct3 = (space == Space.World ? transforms.Value.transform.position : go.transform.parent.InverseTransformPoint( transforms.Value.transform.position) ) + (vectors.IsNone ? Vector3.zero : vectors.Value);
This doesn't take into account the situation where 'go' does not actually have a parent (local space == world space). So a check or perhaps validation would be required at the start of DoiTween:
if( space == Space.Self && go.transform.parent == null ){
space = Space.World;
}
Although the issue I noted with 'Move To Path' may imply that iTween expects the world position should always be used for path & target nodes, but that seems strange to me.
-
Proton, just to let you know that you forgot to include an array index for the transforms array in your solution to repairing the code.
This won't compile because no array index is specified.
[color=red]transforms.Value.transform.position[/color]
This will compile.
[color=green]transforms[i].Value.transform.position[/color]
There's the same problem with the vectors array. You have to specify an index or it won't compile.
[color=red]vectors.IsNone[/color]
This will work.
[color=green]vectors[i].IsNone[/color]
-
That is so strange, my local code looks like yours (with the index).
I'm not sure how I could have copied and pasted with that mistake so many times. I also see that I wrote 'else tempVct3[tempVct3.Length - 1 - i]' instead of 'else tempVct3' for the non-reversed version.
Thanks for the catch!
-
Proton, would you mind emailing or posting the complete fixed version. Want to include it in the update. Thanks!
-
Figured out what happened, since I used 'quote' instead of 'code' it encoded some of my text.
Noticed my last post became italic towards the end, that would be the index '[ i ]' which also works as italicize on the forum.
I've attached the modified file.
-
You were right about the RotateTo not working in local space.
Here's the modified code at line 76:
Change
[color=red]"space", space[/color]
To
[color=green]"islocal", space == Space.World ? false : true[/color]
Local rotation will now work fine. :D
-
Why has this not been changed in 1.2? ??? The bugs just overwrote themselves when I imported 1.2 over 1.1.1! Please make sure to fix this action in 1.2.1
-
Hey, it's easy to miss some things sometimes. Especially with a huge update like this one. Just send Alex a friendly reminder. Also, keep in mind that it could also be an issue with iTween. Try to take a look at the action yourself. Even without much scripting experience, iTween scripting is super easy with some googleing.
-
It's not a big deal, but since the fix is in this thread and Alex answered to it I thought it would be included in the 1.2 update. I changed the action myself. This is not the case for everyone who owns Playmaker. At first I wasn't so happy that my FSMs we're not working normally after the 1.2 update.
I had a backup. It will take me a day or two to recheck everything, but the global variables feature out weights the time to adapt my FSMs to the new version. ;)
-
Sorry about that, I had fixed it locally, but there was an error in the build script (copying action subdirectories). Will be fixed in the next update...
-
Hi,
I know the last reply was over a year ago, but I was wondering if anyone knows if this fix can be applied to the standalone version of iTween too, and if so, how?
Thanks
-
Hi,
you should contact iTween directly I think, if you can report a bug on the standalone build.
tho this problem is really related to PlayMaker usage of iTween, how does that related to the standalone version of iTween? can you explain what's your problem?
bye,
Jean