x


Having Problem With Performing Collison with two prefab object.

Hi,... I'm new to unity .This is my first 2D game project.

I'm using two prefab object 1) DropObject 2) HitObject

1)DropObject:

  • Added BoxCollider with - IsTrigger -Yes -Size X=5 y=5 Z=10
  • Added Rigidbody with default and - UseGravity -No - Is Kinematic -No

  • It is not a moving Object

  • This Object is instantiated to 36 Objects

2)HitObject:

  • Added BoxCollider with

    • IsTrigger-Yes -Size X=3 Y=2 Z=10
  • Added Rigidbody with default and - UseGravity -No - Is Kinematic -Yes

  • It is a moving object.

  • This Object is Instantiated to 4 Objects.
  • It is the Object that hit the DropObject.

Both the DropObject and HitObject have the Z value as 0.

  • I have Used Collision Detection functions like OnTriggerEnter() ,OnCollisionEnter(),OnCharacterCollision().But they are not executing (Checked with print() ).

What do I do to Detect Collision between these Objects.

more ▼

asked Mar 11 '11 at 07:13 AM

Dinesh Balu gravatar image

Dinesh Balu
1 1 1 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You need to attach a rigidboy to one of the cubes. OnCollisionEnter and OnTriggerEnter only fires if one of the colliders is a rigidboy.

You can turn off the gravity in the rigidbody if it is interfering with your logic.

more ▼

answered Mar 11 '11 at 07:35 AM

Extrakun gravatar image

Extrakun
1.3k 44 56 70

Yeah , I've attached rigidbody component to both objects and both prefab objects are GUITexture Objects....

Mar 11 '11 at 07:48 AM Dinesh Balu
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5056
x3717
x2482
x1250
x172

asked: Mar 11 '11 at 07:13 AM

Seen: 1272 times

Last Updated: Mar 11 '11 at 07:13 AM