How to do Collision between Collider and Voxel

0
UtMan1988 posted this 04 February 2017

I have a Projectile object, which is just a rigidbody, a collider, and my projectile script. It has no actual mesh or voxels, just a collider. I want this collider to hit the voxels on an object and trigger an OnCollisionEnter. Currently, that's not happening at all - the collider just goes straight through the voxels.

How do I change this?

2 Comments
Order By: Standard | Newest | Votes
0
GarethIW posted this 04 February 2017

By default, PicaVoxel does not generate MeshColliders for voxel objects (Volumes). You must enable either a Convex or Concave collider (depending on your requirements) in the Volume inspector:

http://i.imgur.com/OjZqjBA.png

A Concave collider will give you the most accurate collision, but there are limitations with concave mesh colliders (they don't work with a Rigidbody attached).

There is also a custom collider script included with PicaVoxel that gives accurate per-voxel collison, but this has its own collision event and does not work with the regular Unity OnCollision events. Page 20 of the manual has more info, and you can also find example uses in the PicaInvaders and PicaShmup demos.

0
UtMan1988 posted this 05 February 2017

Beautiful! I switched to doing the PicaVoxel collision, which was super simple. Thanks again for the help!


Our 305 members have posted 395 times in 93 discussions