It is currently Sat Aug 22, 2020 4:59 am


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: OnCollisionEnter + Colored Cubes Volume?
PostPosted: Wed Oct 21, 2015 3:41 pm 

Joined: Wed Oct 21, 2015 9:06 am
Posts: 1
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OnCollisionEnter + Colored Cubes Volume?
PostPosted: Fri Oct 23, 2015 5:59 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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?


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net