Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: cem on October 29, 2015, 08:25:25 PM
-
I'm having this issue; where i have blocks falling on the character; the blocks have a tween running but it won't "collide" unless the tween has completed.
I wonder if there's a way to do this ?
Thanks
-
Hi,
A tween and physics behaviour (bounces/etc) can't work together, since a tween is like fixed animation that will forcefully go its own way in spite of external forces. So your blocks actually collide, but the tween just make Unity ignore that and move on.
What you could do, is use a callback for collision (like OnCollisionEnter) to determine when a collision happened, and stop the tween so that the physics engine can replace it.
Cheers,
Daniele
-
Hi,
A tween and physics behaviour (bounces/etc) can't work together, since a tween is like fixed animation that will forcefully go its own way in spite of external forces. So your blocks actually collide, but the tween just make Unity ignore that and move on.
What you could do, is use a callback for collision (like OnCollisionEnter) to determine when a collision happened, and stop the tween so that the physics engine can replace it.
Cheers,
Daniele
Thanks Daniele,
But i don't get it; can i write a callback myself ? because on the 'On'Callbacks there's no 'onCollision'.
-
I meant the regular OnCollisionEnter callback (http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html) that you can add to MonoBehaviours ;)
-
I meant the regular OnCollisionEnter callback (http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html) that you can add to MonoBehaviours ;)
:) Nevermind, it worked ! Thanks ! Cheers.
-
Great! :)