HackerPoet / MarbleMarcher

A Fractal Physics Game
GNU General Public License v2.0
2.48k stars 168 forks source link

Triplanar or cube mapping, together with marble's rotation can be used to add skins to the marble #44

Open Ekozmaster opened 5 years ago

Ekozmaster commented 5 years ago

The titles says it all. Maybe, with access to the marble's rotation, using triplanar or even cube mapping it would be possible to implement a skin system for the marbles.

Ekozmaster commented 5 years ago

There could even be a "skins" directory to allow players add/remove as many skins as they want.

HackerPoet commented 5 years ago

The marble currently does not rotate, that would have to be added in to make it work if you want anything but a solid color.

Ekozmaster commented 5 years ago

Hm... Is that hard to add angular momentum for now? maybe in the future that might be a feature...

MichaelMoroz commented 5 years ago

Hm... Is that hard to add angular momentum for now? maybe in the future that might be a feature...

Actually, it's not that hard. Add a quaternion to represent the marble orientation and a angular momentum vector, a sphere has just a unit inertia tensor, and we can integrate it using Euler's method. Though, the biggest problem would be in finding the torques. One approach I can think of: torque = cross(fractal velocity times distance from nearest fractal point(NP) to marble surface, NP - marble center position). I would also add a friction force to angular momentum when colliding with something(proportional to the difference between fractal velocity and marble surface velocity at NP).

To get a more accurate torque you would need to sample all the points inside the intersection of the marble and the fractal - not a simple task I would say.

Ekozmaster commented 5 years ago

I think a pretty physically reallistic torque implementation would drastically change the gameplay, thus causing the high scores of the community to change a lot, kind of reseting the game's identity in some sense. One approach would be to keep the physics interactions as it is, just add friction to rotate the marble, so that angular momentum wouldn't affect the rigidbody's linear momentum. That would imply in some heuristic approach to solve the problem, instead of a logical implementation, but a self moving sphere isn't the most reallistic thing i've ever seen. Is good to stick into a more arcade mechanics style :)