### Author Topic: Thoughts on large body collisions?  (Read 1532 times)

#### d3x0r

• Jr. Member
• Posts: 69
##### Thoughts on large body collisions?
« on: October 22, 2014, 11:18:13 am »
I ended up breaking collisions by shrinking the world voxel size and keeping the same player size.   I see that you built several planes to represent the character at various levels and an axis through the center.

but with small blocks, 3 or 4 blocks can fit in the spaces... so as long as the voxels that aren't in those planes aren't there, you can pass through it...

So I was considering taking the points of the forward and back planes and iterating through the voxels between them... any thoughts?
Was just now considering instead iterating the central axis and normals along the line.... so the character now is slightly larger than 1 block (6 bits; 64 pixels) so most of the collision stuff works... if I dig a 3 wide 1 deep trench in the ground, it works to keep the feet within it... but if I built bars across the path, can go through a lot.
Also some single blocks on just the ground I can go through... maybe I end up going around it...

trying to make an argument for only needing to check +/-1 x and +/-1 z from the center axis... character is say 8 blocks high now... would be 40 voxels to check for collision... but only 2 lookups the rest can be iterated through.

#### olive

• Full Member
• Posts: 149
##### Re: Thoughts on large body collisions?
« Reply #1 on: October 22, 2014, 10:36:37 pm »
I see you have looked at the collision stuff  .

As you can see, the system use a collision points matrix and is raycasting on them with the displacement direction to detect collision on the path of these collision points. The system is optimized by enabling and disabling some points to enable different "detection planes" depending on the displacement direction.

So, you have understood that with smaller voxels, the "holes" in the grid are too large.

One solution could have adding points on the "collision grid" to fill the gaps.

But the problem with a 8 voxel height character is the number of points that will lead to some problems :

- The actual code need some redesign to organize such number of points.
- Some optimization problems could arise with big number of calls for individual raycasting points. But it should be tested.

So, changing the approach could be a good idea.

But maybe you could use some kind of "collision volumes" around the player.

Iterate through these volumes and find the nearest collision voxel if any.

Remember you need the collision distance to allow the player to travel until effective collision.

The Blackvoxel Team
« Last Edit: October 22, 2014, 11:33:26 pm by olive »
Blackvoxel is now a free software!  Visit the official website http://www.blackvoxel.com