mattrdowney / planetaria

A Unity framework for Euclidean 2-sphere games (e.g. 2D virtual reality games) [quasi-MIT license]
Other
10 stars 2 forks source link

Custom Collision system #47

Open mattrdowney opened 6 years ago

mattrdowney commented 6 years ago

Main advantage is that different Planetariums can be placed in different space partitions.

Otherwise, there might be an even-more-substantial gain from the removed overhead of OnTriggerStay -> on_xxx_yyy.

Additionally, Raycasts and continuous collisions become faster.

mattrdowney commented 6 years ago

There's a perhaps-more-substantial gain from removing false positive collisions between colliders (instead of returning a collision object and then determining there was no collision).

mattrdowney commented 6 years ago

There's an insane speedup from removing virtual functions (or even union types) / storing a single type in a single array aka just using spheres everywhere. Additionally, there should be a speedup from the hard-coded radius=2.

mattrdowney commented 6 years ago

The space partitioning algorithm used might also remove many false positive collisions, improving speed drastically.

mattrdowney commented 6 years ago

The best space partitioning algorithm for dynamic objects might be a subdivided octahedral mesh algorithm (R&Ding it might take a while).

For static items, a bounding volume hierarchy might be fastest.

mattrdowney commented 6 years ago

For static items: use a "planar wall algorithm", if the dot product of a point and a plane is greater than the radius (maybe a cached quasi-radius) then the collision is on that side.

(I think this is a specialized BSP with constraints, lol.)

mattrdowney commented 6 years ago

For dynamic items:

Octrees seem like a good starting point, but instead using a quadtree with angle(x,z) +- flat_radius and y_min/y_max since quadtrees have a lot of hollow space.

mattrdowney commented 6 years ago

It's worth noting that Unity's Entity-Component System could work really well with a custom collision system.

mattrdowney commented 5 years ago

I can pretty much guarantee I have to do this, based on what I learned from working on Debris Noirs.

Since I am pretty certain I have to do this, I might as well start soon (maybe after getting .svg files working to improve my morale). The sooner I work on this optimization the better, since this is no longer within the realm of premature optimization.

Yes, I will hate my life while developing this, but at least it's not graphics/GPU programming.