Hi all,
I’ve some issues trying to shake an object in local coordinates with iTween.
Indeed, I’ve an object attached to my camera, and this camera is rotating around my scene.
I wanted to use ShakePosition to shake this object, but it seems that “islocal” just doesn’t work, because my object move from Screen to a strange position (World coordinates?). If I stop rotating the camera around, everything is fine.
My code:
Hashtable wrd1 = new Hashtable();
wrd1.Add("amout", new Vector3(2,0,0));
wrd1.Add("islocal", true);
wrd1.Add("time", 1f);
iTween.ShakePosition(aText.gameObject,wrd1);
aText is my 3D object attached to my camera, and this script is on the camera.
Any solution?
Thanks a lot !
I know this is an old question, but I had the same problem and found a fix if anyone out there has similar issues. You just need to make a minor change in the iTween.cs file.
Go to this function:
void GenerateShakePositionTargets()
and change
vector3s[0]=transform.position;
to
if(isLocal)
{
vector3s[0]=transform.localPosition;
}
else
{
vector3s[0]=transform.position;
}
Hope this helps everyone.
Hi cayou66 ,
try with this… i have used this already and worked well…
iTween.ShakePosition(target,iTween.Hash("x",0.3f,"time",1.0f)); // target game object ... that is object you need to make shake.
// x is axis here.
Hi sriram90,
I’ll try but I’m pretty sure that it won’t work.
It seems that it’s just impossible to Shake and Move an object at the same time…
I tried to modify the iTween function, without success…
I’ll try also a custom function, without iTween.
Thanks !
Wow that’s really cool if it works ! You should contact the developer of iTween to tell him to fix this bug.
Thanks !
Hi
I just had the same problem and solved it through putting the shaking on an empty gameObject, and when it shakes, add (make sure not to set) its X and Y shaking to the camera, then you can move at the same time.
Hope you get it to work!