Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

OnCollisionEnter + Colored Cubes Volume?
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=23&t=655
Page 1 of 1

Author:  EvilWeevil [ Wed Oct 21, 2015 3:41 pm ]
Post subject:  OnCollisionEnter + Colored Cubes Volume?

Hello everyone!

I'm trying to edit the ClickToDestroy script so that it would work with flying projectiles.
Every time a projectile hits the surface it has to destroy some chunks of pixels.

+ for example I want to have a constant procedural elimination of cubes
I just create a sphere which constantly grows on and on and constantly destroys pixels which it reaches.

I was trying to work with the OnCollisionEnter void.

void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag ("Player"))

...


Without much of success however.
Maybe its the wrong logic?
Perhaps you could help me find the right one?
Thanks.

Author:  David Williams [ Fri Oct 23, 2015 5:59 am ]
Post subject:  Re: OnCollisionEnter + Colored Cubes Volume?

EvilWeevil wrote:
I was trying to work with the OnCollisionEnter void.

void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag ("Player"))

...


As far as I can remember I haven't worked with the OnCollisionEnter functionality and so it might not work (I may not have implemented whatever internal setup would be required). Cubiquity volumes don't have a MeshCollider component attached, but instead they have a VolumeCollider which internally does set up a number of MeshColliders for each chunk. I can imagine that for OnCollisionEnter() to work there may need to be some additional messaging/communication between the MeshColliders which are used internally and the VolumeCollider which is exposed to the user. It can probably be made to work if you are feeling brave about diving into the code base :-)

Failing that, you may need to rely on other techniques. The ClickToDestroy script already shows how to iterate over the voxels in a given part of the volume, so in the case of your expanding sphere you may just need to call this with increasingly large spheres. Or maybe spread the calls over several frames. Or build a list in advance of the voxels to be removed and remove a few each frame. Actually I'm not exactly sure of the best approach, some experimentation may be needed. How big does your sphere need to get?

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/