dotween doshakescale reseting to original scale
I am trying to make a 2D sprite bounce like jelly using DoTween's DOShakeScale. I put DoShakeScale inside OnCollisionEnter2D so that my bouncing sprite could shake scale like some jelly block. But the scale does not revert when the bouncing stops. Is it possible to revert an object's scale to its original after a doShakeScale ? Edited: the script reference is just the Collision detection.
void OnCollisionEnter2D(Collision2D other)
{
transform.DOShakeScale(0.1f, new Vector3(0.4f,0.3f,0f),0,0f,false);
}
dude let people see your script ,maybe someone could help you :)
I added the code. It's just the Collision Detection in OnCollisionEnter2D. There's a DOShakeScale inside that.
Answer by Shiv7n · Mar 31, 2020 at 01:31 PM
In case someone would find this thread :
transform.DORewind ();
transform.DOPunchScale (new Vector3 (1, 1, 1), .25f);
Answer by Nikhil_Ghode · Mar 11, 2020 at 11:46 AM
I would rather prefer not to use DOShakeScale
i usually use this to replace DOShakeScale:
Vector3 OriginalScale= transform.localScale; DOTween.Sequence() .Append(transform.DOScale(new Vector3(OriginalScale.x + 0.5f, OriginalScale.y + 0.5f, OriginalScale.z + 0.5f), 0.2f).SetEase(Ease.Linear)) .Append(transform.DOScale(OriginalScale, 0.2f).SetEase(Ease.Linear));
Your answer
Follow this Question
Related Questions
IEnumerator Tweening vs Animator - Which is the better performance choice? 0 Answers
Is there a unity tool to record/render an animation with sound to mp4? (no screenrecorder) 0 Answers
can anyone tell me where do i get alembic plugin for unity and how to install it for the same..? 0 Answers
stickman animation 1 Answer
Animating Through Blend Tree - Method not implemented? 0 Answers