About 'GameObject Shredder'!

In this video (objectives)…

  1. Create Shredder object and script.
  2. Test for trigger and then destroy object which collided.

After watching (learning outcomes)… Able to destroy GameObjects which collide with our trigger volume.

(Unique Video Reference: 10_LD_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

I have done everything with the code. Attached the shredder game object. Used the 2D colliders. However the program isn’t working. The game objects are not being destroyed. Why?

My guess is that you’ve done what I usually do - you may have forgotten to make one of the colliders “Is Trigger”.

I have :smiley:

I just spent an hour with the same issue, just realised I had used box collider and not box collider 2D. You live and learn :persevere:

3 Likes

I also spend quite some time to get it working. In my case, I had to add checkmarks in the ‘Layer Collision Matrix’ (Project Settings -> Physics 2D).

layer_collision_matrix

I was able to get the laser destroyed by setting the IsTrigger property as Rick mentioned.
However I couldn’t get the collision effect as displayed in the video.
I was frustrated and spent about an hour to understand why.

Eventually I found out that in order to get the collision effect I had to set the Laser Rigid Body type to “Dynamic” and set the gravity scale to zero.

In case it helps anyone.
Cheers.

Thank you paul - saved me an hour!

An issue with Unity version 2019.4.15

I utilized all of the above guidance and my Shredder was still not working. After experimenting for a while I found that it would or wouldn’t work depending on my ship’s distance from it!

For example: If my ship was at the bottom of the screen it would work fine, but if I moved it up the screen a few centimeters it wouldn’t work. I’d move a few more centimeters up the screen and it would work again, and so on.

I rebuilt the project in a previous version of Unity and everything works fine, so I think the problem is with Unity… Unless someone has a different explanation?

Privacy & Terms