ThreeJS and the first SpaceStation test app

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. 🙂

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: