- Home /
Problem with itween collision detection.
I recently purchased playmaker, and with it comes itween. While i really like it, there is one thing i cant get to work: collision detection. For example: Shooting a bullet with a collider using itween, wich i want to hit (for example) an enemy wich also has a collider, and on Collider Enter the enemy should die (or something else).
i tried:
-putting an rigid body with is kinematic checked on one of the objects.
-checking is trigger on one of the objects
-and just using 2 colliders
Note: i use playmaker for scripting
please help me. i was not able to find someone with exactly the same problem
thanks.
Answer by sparkzbarca · Nov 13, 2012 at 01:32 PM
lets be clear i've never used playmaker but based on a quick youtube video showing some of it.
http://www.hutonggames.com/tutorials_game_design_with_playmaker.php
check tutorial 3. its pretty close to what you want. though its checking for player collision.
10:15ish in shows you how to specify a game object to trigger something. again you want oncollison enter but its pretty much teh same thing.
you want to specify the bullet object instead of the guitext object he is using. So you'll be dragging your bullet object down there to specify it.
after that do whatever action you want on bullet collision.
you can do damage or just die.
in the event you want to die. the action your looking for is destroy.
destroy owner.
Answer by reinvdw · Nov 13, 2012 at 10:03 PM
Thanks, but triggers work fine. The problem is that when one object i being moved by itween, on collision enter doesn't seems to do anything.
Answer by reinvdw · Nov 15, 2012 at 08:48 PM
Problem solved! :D putting a rigidbody on the moving object and checking is trigger on the object to collide with gives the proper result.
Answer by CollosalChris · Mar 25, 2014 at 09:32 PM
Something that seems to work is to set the collider of the obstacle you are colliding with to be a trigger then add a script to that obstacle object with code similar to this: (This will stop any tweening iTween is working on and gives you a chance to do anything you want once the collision occurs)
void OnTriggerEnter (Collider target) {
iTween.Stop ();
//do what you want with collision
if(target.tag == "Player"){
//etc, etc
}
}
I also have no idea how you would code this with playmaker. Good luck to you