- Home /
Camera shaking and parent movement
Hi!
I 'm having an issue with iTween and shake camera with ShakePosition function.
The structure is a gameObject with a rigidbody component, and a child with the main camera.
I move the camera adding a force to rigidbody of the parent object, and I shake the camera using iTween.ShakePosition on itself.
My problem is when I shake the camera, the parent (rigidbody) is stopped, and resume the movement when the shake of the camera ends.
The strange part is if I use another function such as iTween.PunchPosition instead iTween.ShakePosition, it works properly.
Any helps? Thanks in advance! Pablo.
$$anonymous$$ost likely sounds like a bug. Bob at PixelPlacement states that iTween animations in correlation with a rigidbody should prevent interruption of non-kinematic rigidbodies by animating inside of FixedUpdate().
Answer by ScroodgeM · Aug 08, 2012 at 10:16 PM
methinks iTween (don't know what is this) stores camera's position before shaking effect and then applies new position some times a frame using
NewCameraPosition = StoredCameraPosition + RandomOffset
so moving is overrided and every time position is set to it's stored value.
what can you do?
solution
add little improvements to script that stores and changes localPosition of camera instead of position. localPosition is relative-to-parent position and can be changed by iTween safely for shake effect while parent with rigidbody moves.
if you stuck in it, post a source of
iTween.ShakePosition(...
method, we will help 8)
Your answer
Follow this Question
Related Questions
Camera stutter when following a RigidBody2D 0 Answers
Smooth camera shift, Lerp? SmoothShift? 2 Answers
Camera gets stuck when cursor is locked 0 Answers
Issue with my camera controls 0 Answers