Is it possible to simulate iTween movement, but so that the object wouldn’t go through stuff, but rather stop whn collides with sth?
Set up a check for collision enter then just call one of iTween’s stop methods.
I am having a similar issue, can you please explain how do you setup a check for collision enter?
I couldn’t find an API call for this.
Thanks a lot for your help,
Varun
Use OnCollisionEnter: http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnCollisionEnter.html
When I use iTween(iTween.MoveTo()) for moving an object the OnCollisionEnter() function is never called. It is getting called if i move the object with rigidbody.AddForce().
Can you please explain how OnCollisionEnter() function can be called while using iTween?
Thanks again!
Varun
OnCollisionEnter gets triggered whenever two colliders hit. Just stop tweening whenever such a thing occures. I’m not familiar with iTween, but I am with Actionscript Tween classes, and if you add a Tween to its current position it’ll just stop tweening.
The problem is that OnCollisionEnter doesn’t get triggered when my object is moving using iTween.MoveTo(). I can only stop when i get a collision event, but the problem is that I don’t get a collision event because of iTween
Thanks,
Varun
Looked up the docs and iTween has a Stop() function:
Stop() Stop and destroy all Tweens in current scene
Stop(string type) Stop and destroy all iTweens in current scene of a particular type.
Stop(GameObject target) Stop and destroy all iTweens on a GameObject.
Stop(GameObject target, bool includechildren) Stop and destroy all iTweens on a GameObject including its children.
Stop(GameObject target, string type) Stop and destroy all iTweens on a GameObject of a particular type.
Stop(GameObject target, string type, bool includechildren) Stop and destroy all iTweens on a GameObject of a particular type including its children.
You’re sure both have colliders components attached?
Yes iTween.Stop() does stop tweening but I want to stop when i get a collision event. The problem is I don’t get a collision event
If i move the object using rigidbody.Addforce() then the collision event gets triggered but when i use iTween.MoveTo() then it doesn’t get triggered.
Yes both my object has colliders components attached.
Thanks
Varun
I also bought this example “Working with Physics” from iTween for Unity by Bob Berkebile (pixelplacement)
And I added this function to Brick.js
function OnCollisionEnter (collision : Collision)
{
Debug.Log(“Collision Detected”);
}
But this debug message never gets printed
Thanks,
Varun
And what about OnTriggerEnter? Does that get a call after a collision?
I was able to resolve this issue by enabling kinematics for 1 game object
Thanks all for your help.
Varun