After playing around with the LittleBigPlanet level-editor with Niall, I wanted to see how well I could let a user tie objects together with a string/rope/chain.
Here’s how I implemented it:
- A raycast picks a rigid body and gets a position in worldspace where it hit, and a second raycast picks the second body and wordspace position of the hit.
- These worldspace co-ordinates are then translated to local space, extended a bit so they’re a little bit away from the surface of the bodies.
- A chain of links is then constructed in place between the bodies, with their correct positions and orientations. The number of links is decided by the distance to be covered.
- Each link gets a small sphere representing it. Maybe a spline curve is better if it’s a string? Or maybe a cylindrical mesh with a skeleton for a rope? Or if it’s a chain, individually rendered 3D links? Or would a billboard for each link be better? I like that last one actually…
What I need to add/change:
- Ensure that the path along which the chain is to be constructed is not obstructed by other bodies.
- Make the chain lighter… right now it’s quite heavy, and I have to figure out how to maintain stability without having to make it so heavy.
- Increase stability when constraining a body to fixed geometry.
- Figure out how to create a stable chain between two bodies decided by a user. One could be hugely heavy, and the other too light, which would cause problems. Or both two light or too heavy for the chain. Interesting problem.
I spent a lot of time last night researching Windows device drivers. I’m thinking of writing a virtual joystick driver so an iPhone OS device could be used as a generic controller for any game which supports DirectInput joysticks. I found some good information on writing device drivers, but that’s only a device driver; I need to figure out how to create a virtual joystick too, I believe. From my reading, it seems that Windows will load a device driver when it needs it (which makes sense), but without a new device being discovered, Windows won’t go loading any drivers.
I did, however, find some sample code in the DDK (Windows’ Driver Development Kit) for creating a virtual HID driver, but could not figure out how it was doing that. I think it may be HID-specific functionality which won’t help with DirectInput-compatible joysticks
Looking at Microsoft’s UMDF (User-Mode Driver Framework), it looks like Microsoft is getting serious about making a usable driver framework, but this technology still seems quite new. On Microsoft’s official product page it’s all about UMDF in Windows 7! Though I’ve read that UMDF drivers are XP-compatible…
I also researched iPhone OS development a little more, submitted my Apple Store order for the Standard iPhone Developer Program so I can run my own code on my iPod, and found some good sample code that does some of the stuff I’m hoping to implement (WiTap for using Bonjour, GLGravity for reading accelerometer input).
