Archive

Posts Tagged ‘bitwise’

None the Bitwiser

March 4th, 2009

Bitwise Operations
For those of us without computer science degrees, a lot of the lower level guts of programming often remain a benign mystery until we encounter them in some code we need to borrow. In the Glaze physics engine, layers delegate which collisions will happen between the bodies in the physics simulation. The layer object is a unsigned integer expressed as hexadecemal:  “0xffff”    The function used to determine if Rigidbodies collide is a bitwise AND.

One needs to grasp hexadeciaml to binary conversion and bitwise operations to control all 32 layers of collisions.  I immediately wrote a function to  obfuscate these ugly bitwise things and assign a rigid body’s layer without suffering the unintuitive process of converting and comparing. I do appreciate that bitwise comparison is very appropriate for the collision layers, but it is very satisfying for me to spackle over it and never have to deal with it directly again.

Starting down the programming path by way of a flash designer, I have a rather mollycoddled perspective when it comes to coding.  I am not very interested in making a compiler, or noodleing with memory management or lower level tinkering… not yet anyway.

, ,