ThreeJS and the first SpaceStation test app

Spread the love
8 / 100
Reading Time: < 1 minute

Great fun today. Started with getting further into Three.JS. I added some couple of hundred lines, pretty spaghetti in the end.

So the app is a clone of really nice demo of Threejs that I found on Codepen. Made it run separately on a standalone ‘express’ Node server, and then I just fired away and started making changes, a lot.

Gravity

Made gravity work, so that things fall to the surface of the demo app. There is also a elastic bounce, simply by reversing part of the energy (“dx”, acceleration vector) of a falling object, once it hits the floor. So it quickly reverses, but loses some of its power.

Jiggle of the objects?

A third thing that seems to be good to have is a hysteresis prevention; since each bounce in the object takes a fraction of its value, if we wouldn’t keep this checked with some definite limit, I was afraid that eventually there would be really weird behavior. Well, turned out actually the sequential divisions of the acceleration vector along with sign reversal didn’t make any weird jiggedness, but still I kept the damping check in place. 🙂

Facebook Comments Box

This site uses Akismet to reduce spam. Learn how your comment data is processed.