I need help with parenting an Object to an other after a collision occurred for a specified amount of time generally spoken. I will try to explain it more detailed, but first I want to let you know that I´am trying this for a few days now and I don´t get it working properly.
We have Object A, this is a moving Prefab and we have Object B it has a collider and a script that should wait for collision with Object A, and if the collision is happening for the amount of X time Object B should become the parent of Object A. If A and B are colliding for a lower time than X no parenting should happen.
-Yeah, sounds simple but not for me I really don´t get it working, I have not much programming knowledge and I think I´am missing a basic programming concept. I wrote a lot of diffrent scripts the last days but none of them worked properly, and I know most of you do not respond to Questions that have no scripts attached but I want to understand(!) not guess what is right so please help.
Thanks in advance for the time you invest,
asked Apr 09 '12 at 08:11 PM
This is a simple example that should do what you need. You could use OnTriggerEnter and OnTriggerExit instead of a constantly running checks in OnCollisionStay but this is more informative than actual implementation. This pseudo-code is not performance-friendly, but perhaps it'll give you hints.
answered Apr 09 '12 at 08:33 PM