x


Removing circular chunks of objects in 2D game

Summary of problem:

  • I have an object with a circular radius of effect
  • As it gets close to objects, I want them to disappear, but only the overlap between the circular area of effect and the object.
  • I also want to disable the colliders for the vanished bits.

Any thoughts on how to do this? My preliminary ideas are:

  1. Since this is a 2D game, I can do depth tricks. For example, I can move the objects a few meters backwards and overlay a circularish chunk in front of them. I could make this chunk a trigger with scripting that disables colliders while things are inside it, so objects can move through.

  2. I can hide the object completely and replace it with very small tiles that vanish when they're in the area, temporarily.

Ideally, though, I'd just like to specify the areas to wipe away, and have the collider mesh and the rendering area disabled for that part (and come back when the area of effect object leaves).

Any insights would be greatly appreciated :)

more ▼

asked Mar 13 '12 at 01:52 AM

armoredpokey gravatar image

armoredpokey
100 5 6 7

Also, does anyone know if it's possible to create a circular camera view?

Mar 13 '12 at 09:11 PM armoredpokey
(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

Disabling rendering and collision of entire objects within a given area of influence should be relatively easy, but it sounds like you're asking about disabling parts of an object where it overlaps with something else? That should be possible in theory, but sounds extremely difficult, especially if you're editing collision on the fly.

more ▼

answered Mar 13 '12 at 03:42 AM

rutter gravatar image

rutter
5.2k 2 11

yep, that's the goal. any thoughts about how to do it? If I can create on-the-fly a game object with a shape I can mathematically describe, i know i can do it.

Mar 13 '12 at 11:18 AM armoredpokey
(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:

x1705
x492
x91
x58

asked: Mar 13 '12 at 01:52 AM

Seen: 526 times

Last Updated: Mar 13 '12 at 09:11 PM