Refining Physics and Inspecting Objects

January 13th, 2008
Spencer Nielsen Follow snielsen42 on Twitter

After a long time tweaking and puttering with the physics engine I think I have finally gotten close to the kind of settings that are needed for the kind of simulation that I want (dContactApprox is the flag that finally fixed a lot of my problems). I have also introduced projectiles into the mix by adding the “Shell” class. The Shell class is actually just an Actor and is treated the same was as any other tank or other object in the game. It just so happens that tanks create shells and they initially have a great force exerted on them.

I have also put a lot more work into NSObjectInspector (probably to be renamed in the future) so as to be able to support more debugging of the plugins at runtime. I am getting the hankering to spin it off as a general debugging tool for developers because it is just so darn useful.


The idea behind NSObjectInspector is that when you debug a program sometimes you want to just change a value in an object while you are debugging your program at runtime instead of recompiling or writing some sort of user interface to interact with an object’s value. Because the Objective-C runtime affords us a lot of information about what instance variables an object has or what methods it has implementations to, we can provide a general class that can inspect other objects and provide a user interface with which to poke at them with.

Currently it provides interfaces to object instance variables, accessors (method or method pairs in the form of -(void)setMethod:(type)a and -(type)method) and commands (methods in the form of -(void)method). It currently excludes anything in the class NSObject and well known methods that have substantial peripheral effects such as -(id)init, -(void)dealloc and -(void)finalize. Currently supported values are any sort of number type and ids of type NSString. Eventually I plan on creation of class specific exemption lists as well as control hookups.

Leave a Reply

Entries (RSS) and Comments (RSS).