Archive for October, 2008

Lightwave -> Papervision3D

Thursday, October 30th, 2008

In this post, I’m going to go through how to get a textured model from Lightwave into Papervision3D. It’s really not as easy as I should be because of the lack of a collada exporter in Lightwave. The title should actually be more like: Lightwave -> wavefront obj file -> Blender -> dae file -> Papervision3D.

I use Lightwave for no other reason than I used to use it back in my Amiga days and since I rarely need to do any 3d work, there seems little point in learning another 3d package when I have so much else to learn :) They have a ‘discovery’ (ie free) edition too.

There are many, many pitfalls in this process, but once you’re aware of them, it doesn’t take long to do. I’m going to assume that you know nothing about Blender (as I did 8 hours ago) but do know how to use Lightwave. If you don’t know either, you might be better off either learning Blender straight off (or Maya). Props to Altered Egg for the details on what to do in Blender. He’s got pictures and stuff, if you need them :) I’m using Lightwave 9 and Blender 2.48
(more…)

Flash Flex Font Fudging

Tuesday, October 21st, 2008

Yesterday I spent quite a while trying to get some fonts to display correctly in a Flex Actionscript project. The method I normally use is the one I outlined in this post. This method is good because it allows you to embed only the characters you need and has always worked. Except yesterday.

The main difference as far as I could tell was that I was mixing Flex components and Actionscript text fields. The font was displaying in the Flex, but not the Actionscript. I had embedded the font using Flex’s CSS, so I thought maybe it wasn’t being passed over to the flash, so I embedded the font using the method above as well. Still no joy. I then removed the font completely from the Flex, in case it was screwing things up. Again, nothing. At this point I was getting pretty frustrated, as you could imagine. I went back over the Embedding Fonts technote and noticed that it said that only Truetype or bitmap fonts were supported. So I checked the font type. Sure enough, it was Truetype. About an hour later I decided to reinstall the font in case it was corrupted (it was showing fine in the Flex and in the Flash IDE, so I thought it unlikely). When I looked at the actual file in finder, it had the extension .dfont, which apparently is a datafork truetype font. Make no mistake, this is not supported by Actionscript.

So, in the end I installed a simple Truetype version and it worked straight off. No embedding needed in the Actionscript, just the CSS. I haven’t tried out the new font engine in Flex 4/Flash Player 10, but I really, really hope it doesn’t make you jump through quite so many hoops to display some text right.

Revised Cart Physics

Friday, October 3rd, 2008

Having read through Marco Monster’s car physics document (from this post) I thought I’d make some adjustments to the way my cars accelerate. Turns out that I had pretty much got it right, but there was one important factor that I hadn’t considered – air resistance. This is a big one because it incorporates the square of the car’s speed. This means that as the speed of the car increases, the resistance increases exponentially. Currently I have a maximum speed limit for the car, which is a bit clumsy and I’ve never really been comfortable with, as it’s another “magic constant”. With this method the car will eventually top out all on its own and I can remove a bunch of max speed tests. Following the jump, I’ll explain how I took the equations presented in the paper and put them into Box2D to provide something useful. I’m simplifying the model as presented in the paper, since I don’t really need it all (I’ve removed mass transference, gearing, torque ratios etc.) because I’m using carts. I might put in gearing at a later date, but I’d always rather having something working first and then change it if it isn’t fun enough :)
(more…)