I'm trying to use iTween's ShakePosition to add a camera shake effect. I have the camera parented to an object that is aligned to and moving along an iTweenPath. When I use ShakePosition it temporarily stalls the camera from moving forward while the shaking takes place and then resumes its movement, but is now trailing behind its previous position by several units. Multiple shakes in a row essentially stop the camera from moving anywhere at all. I'd prefer it if I could keep the camera held at its current position(that's constantly moving along the path) and perform the shake around that without stopping.
ShakeRotation has a similar effect except instead of falling behind it seems to be obtaining a final rotation that the shake uses to shake around and align to on completion. While shake is active it will stop keeping up with the current constant orientation until the shake is complete, at which point it resumes but with the new altered rotation.
Should I try to find a way to constantly update the vector3 it's performing the shake around?
Maybe I should just make my own camera shake..
iTween can't move two properties at one time. Try shaking a parented camera and have it's parent follow the path instead of trying to do it all on one transform.
Hey there, i know it’s an old question but i had the same problem so i found it and thought i might share the answer.
parenting is the solution as Bob Berkebile pointed out, but it seems that it only works the other way around.
drop the camera into an empty gameobject to parent it and then:
let the child (the camera itself) follow it’s path and shake the parent.
I had the same problem: getting a gameobject to shake while using another iTween function (following a path or moving). The key is parenting. The parent does the movement while the child does the shake. However, I had to do some crafty update, onupdate, and oncomplete functions for it to work. Note: I only needed to have the child follow the parent’s y position during the shake. Hope this helps.
`function Start ()
iTween.ShakePosition(transform.gameObject, iTween.Hash(“x”,shakeAmount, “time”, duration, “delay”,delay,“easetype”, iTween.EaseType.easeInOutQuint, “onupdate”, “StayWithParent”, “oncomplete”, “StayWithParent”));
function Update ()
transform.localPosition.y += transform.parent.position.y - transform.position.y;