Space Nerds In Space Big Honking Death Machine

January 2, 2017 — Star Wars has its Death Star, Star Trek has its Borg Cube, its high time Space Nerds In Space had its Big Honking Death Machine, which is what I’ve been working on lately.

The simplest possible approach would have been to build a 3D model much as I’ve done previously and just put it in. But I wanted the players to be able to interact with this thing in a way that you can’t interact with a simple model, at least the way they are currently implemented. I wanted players to be able to fly around and even inside this giant thing, and bump into the solid parts but fly through the empty parts. Doing that with a normal 3D model is pretty hard, too hard for me at the moment. It occurred to me that if I could make a kind of generic “block” with arbitrary height, width, and depth and orientation and I could get texture mapping and more importantly collision detection working with such a block, then I could arrange such “block” objects in a hierarchy, with relative positions and orientations and in this way be able to construct large “ships” out of many of these “block” objects — much like LEGOs, but without the alignment constraints. And so that’s what I’ve done.

Each of the blocks uses the same mesh, a unit cube, but each block has its own non-uniform scaling factors for x, y, and z. The collision detection is done using “oriented bounding boxes”, as described in Christer Ericsson’s book, Real-Time Collision Detection. The collision resolution is very simple minded at the moment. In the detection phase, the “closest” point on the surface of the block is identified, and a vector is constructed from this point to the player’s ship and the ship is “pushed back” a fixed amount in this direction and the velocity is set to zero. This mostly works, though it doesn’t look or feel all that natural, and once in a while penetration of walls may occur.

 

~ by scaryreasoner on January 3, 2017.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: