non rigid body objects collisions

Is it possible to get an OnCollisionEnter with 2 objects that neither have rigid bodies (but both have colliders (box and capsule))?

If not, and I have to use rigid bodies, how many can I have before my system blows up?

Requirements call for as many as 200 active objects on the screen, that may or may not collide with each other (based on what type of object they are).

Use Rigidbodies set to kinematic. 200 objects shouldn’t be an issue unless they’re all colliding at once (and even then it might not matter).

much thanks.

alright, no need to create another thread.

Problem, my guy is colliding with his bullets and the bullets are colliding with themselves.

related scripts:
PlayerController:

 if(firecounter == 1)    // first shot fire
                {
                    totalshots++;
                    shot = Instantiate (IcarusBullet, transform.position + Vector3.forward * collider.bounds.extents.z, transform.rotation);
                    //shot = new GameObject ("shot" + totalshots);
                    // spawn one object in the middle front of Icarus
                }
                else    // not the first shot
                {
                    totalshots++;
                    shot = Instantiate (IcarusBullet, transform.position + Vector3.forward * collider.bounds.extents.z  + Vector3.left * 4, transform.rotation);
                    totalshots++;
                    shot = Instantiate (IcarusBullet, transform.position + Vector3.forward * collider.bounds.extents.z + Vector3.right * 4, transform.rotation);

My Bullets code:

void Start ()
	{
		//GameObject.FindWithTag("GamePath")
		transform.parent = Camera.main.transform;
		rigidbody.velocity = transform.rotation * Vector3.forward * bulletspeed;
		Destroy(gameObject,killTimeIfNoCollide);
	}
	
	void OnCollisionEnter (Collision collisionInfo)
	{
		
		if(collisionInfo.gameObject.tag == "IcarusBullet" || collisionInfo.gameObject.tag == "Player")
		{
			Debug.Log("Ignoring collision with " + collisionInfo.gameObject.tag + " at " + Time.time);
			Physics.IgnoreCollision(collider, collisionInfo.collider);
			return;
		}
		if(collisionInfo.gameObject.tag == "Neutral")
		{
			Destroy(gameObject);
			return;
		}
	}

http://sky289hawk1.dyndns.org:8080/webplayer.html

On Another note, how come my bullets don’t move with my camera (I set the parent to the camera, so everything stays on the same “plane” of play. But when I rotate the camera, They don’t quite stay on the plane.

One thing I see is that you’ve got IgnoreCollision inside an OnCollisionEnter function. But by the time there’s a collision, it’s too late to ignore the collision since it’s already happened. The purpose of IgnoreCollision is to prevent OnCollision functions from ever occuring, so that needs to be set up in Start or something.

–Eric

doing the ignore collision on all tags on start would be an expensive operation.

Well, there’s really no way around that if you want collisions to be ignored. :slight_smile: You simply can’t call it after the collision has occured because it will have no effect, other than to ignore any further collisions (but that’s not what you want). Anyway I doubt you’d see any problems unless you have an insane number of objects.

–Eric

well, pre optimizations, I am expecting about 500-700 items existing in the level at any one time. If I limit that to what’s on screen/in frustum, I can cut that number to around 200 top end.