- Home /
 
Using contact point
I looked through the script reference page for contact points but I am still unsure on how to use it in my position. I have a for loop that applies to every object within the array setup with on trigger enter. The code is as follows:
 function Update()
 {    
     for(var hit in colliders)
     {
         //Set the Various Stats, calculated and read from varass, to each object
         if(hit.rigidbody)
         {
             var waterLevel = transform.position.y;
             var floatStats = hit.collider.gameObject.GetComponent("varass") as varass;
             var floatForce  = floatStats.bouyancy+((waterLevel-hit.transform.position.y)*5);
             var returnSpeedX=(floatStats.IXPos-hit.rigidbody.rotation.x)*5;
             var returnSpeedZ=(floatStats.IZPos-hit.rigidbody.rotation.z)*5;
             hit.rigidbody.drag=1;
             hit.rigidbody.angularDrag=1;
             
             //Apply current and float force
             hit.rigidbody.AddForce (floatStats.xCurrent, floatForce, floatStats.zCurrent);
             transform.RotateAround (ContactPoint, Vector3.right, 2);
             transform.RotateAround (ContactPoint, Vector3.fwd, 2);
         }
     }
 
 }
 
               In the place of 'ContactPoint' I want to call the contact point of each object on contact with the water. First of all do contact points work with a trigger or not, and if so what syntax would i use to find the contact point of each object in the array.
Thanks, Langy
Answer by Bunny83 · Feb 11, 2013 at 04:15 PM
ContactPoints are part of the Collision class which is only passed to OnCollisionEnter. That means it doesn't work with triggers. Triggers can intersect other colliders / triggers, so there are no contact points.
I was afraid someone would say that, ah well, back to the drawing board I guess, cheers.
Your answer
 
             Follow this Question
Related Questions
Rotate character on trigger enter? 1 Answer
Boolean detection on collision. 1 Answer
Collider not detecting trigger 1 Answer
On Trigger Enter Not Executing? 1 Answer