OnCollisionStay inactive without OnCollisionEnter?

Hi,

  • I have a sphere that is rolling atop a cube, the sphere is a rigidbody.
  • When the sphere hits a trigger, delete the trigger and add a script to the sphere
  • The script contains an OnCollisionStay() method. this isn’t activating even though the objects are touching (sphere and cube).
  • However the script does active when the ball leaves/lands back on the cube.

So my question is;

Can OnCollisionStay not activate between objects that are already touching before the
script is created?

Cheers,

hey,

First you want to detect isTrigger. So you have to specify a script on object with

void OnTriggerEnter(Collider other){

if(other.tag == “toWhichYouWantToDetect”)

// In the case you want dectection with some specified
// objects otherwise ignore the if Statement

{

gameObject.GetComponent().isTrigger = false;

// attached a script to sphere you want to active on trigger and uncheck it to deactivate
// and active it here like this

gameObject.GetComponent().eanble = true;

}

}

Hope this works

Sorry, let me clarify.

The trigger is ONLY used to add a script to the sphere then delete itself.
That script contains OnCollisionStay() which SHOULD(?) begin immediately firing as the sphere is colliding with the cube it rests apon. This isn’t happening until the sphere leaves the surface of the cube and touches again (think jump).

Why isn’t OnCollisionStay immediately fired?

Cheers,