I tried to get Apple’s SCNPhysicsVehicle class working nicely, from scratch (no template project), and learnt a whole lot of stuff about how to do that successfully. I may add to this page over time, to collect further wisdom.

It really did drive me crazy for a number of days, as I really wanted to make it work by creating the most basic car in the scene editor: a rectangular block for the chassis, and four cylinders for the wheels. The only reason I added the pyramid to the top of the chassis is to make it more obvious which way the ‘car’ is facing!

I got some properly wacky and confusing results, until I figured all of this out.

  • Make sure no nodes have any scaling on them.
    • If creating from primitives, use the width/height/length attributes to get the right dimensions, instead of scaling.
    • If you use scaling instead – e.g. to make a cylinder flatter to look more like a wheel, or to lengthen a box to make it look like a car body (use your imagination) – then weird things happen.
  • Make sure no nodes have any Euler rotation on them.
    • If your wheels have any rotation on them in the scene, that is then undone when your wheels are displayed . If you’re using primitive cylinders as wheels, this is a problem, since they need rotating to not stand on end. The solution is to use imported models instead of a primitive or add a child node that then contains your rotated wheel. Either that your child node or model have the correct origin for wheel attachment point, and no rotation.
  • SCNPhysicsVehicle seems to make some built-in assumptions that your vehicle and its wheels will be aligned in the scene file such that it drives backwards and forwards along the z-axis.
    • If you build the scene so that it is along the x-axis (so at 90 degrees to z-axis) then the wheels get oddly rotated 90 degrees and roll end over end instead of how they should.
  • Steering wouldn’t work when I set steering angle as part of car setup code, but did work when setting in delegate callback each frame. Perhaps it’s too early during setup.
  • Only the main chassis geometry seems to count for collisions – the wheels will go beneath the floor if you roll onto the side, and a pyramid on top will also if rolled onto its roof. Only the main box physics seems to be effective. Perhaps I haven’t set things up quite right.
  • For applyEngineForce() and applyBrakingForce() it seems the docs lie and you do need to reset to zero if you want to remove the effect. My first attempt ended up with brakes and throttle both stuck on and strange behaviour as a result.
03. September 2009 · Comments Off on Test Page · Categories: Uncategorized

This is a test of the pages mechanism of TypePad.

We went to Whipsnade Zoo at the weekend, because it's fairly close by (surprisingly so – only took 25 mins from St Albans) and we've been meaning to for a while. A two-for-one voucher from a cereal box was the clincher, saving us £17 on the entry price. We did exactly the same for London Zoo a couple of months back. With Whipsnade being run by ZSL it's a sort of outpost of London Zoo and so we couldn't help but compare and contrast the two.

The first thing we noticed is that it's a lot colder, windier and greyer. But that could just have been autumn arriving with full force. It's certainly a lot more open, with some really huge paddocks of green grass, trees, hummocks etc. with animals dotted about within them, almost Safari park like. That does mean there's less variety overall and it's a bit of a walk to get around, but it's pleasant and you feel the animals are probably happier with the extra space. At least some of them. One medium sized oak was home to this delightful red panda. It was easily the cutest thing we saw all day, beating the otters into second place.

RedPanda

It struck me that all it had to do to escape was walk to the end of a branch and jump past the fence. Presumably it isn't so inclined. I always seem to end up figuring out escape plans for the animals, and it often looks like it wouldn't be so hard. If the chimpanzees simply got together and dragged a branch into the right place they could be up and over the fence, tall as it is, in a jiffy.

We caught a sealion show, which was quite impressive. Three out of the four of them provided accomplished routines, whilst the fourth (Dominic, the youngest) played the fool, which added to the charm.

SealionsGroup

I took my big Nikon 80-400mm VR lens and was glad I did as it really helped to get in close, especially given the large enclosures often meant the animals were far away. It's not that great for action, being a bit slow, but I got a half-reasonable jumping sealion.

SealionJump

I rate the zoo quite highly and would recommend allocating a whole day to visit, though it's a shame it doesn't have a bit more dense indoor stuff (insects, reptiles, fish etc.) to counter-balance the wide-open spaces. It has just the one very cramped Discovery Centre which is decent, if a bit MDF heavy, but the zoo could do with more of the same, spread about the place and implemented in a slicker fashion. There's a bit of a crumbling feel in a few places and the signage to tell you what you're looking at is woeful for most of the outdoor stuff.

I took a great many pictures, as usual, but I'll finish with an obligatory tiger – grrrrr!

TigerSleepy (1)

Taken in Dorset near Lulworth Cove when we went down for a long weekend last summer. I love the way the seagull is camouflaged against the rock.

Seagull

I’ve been looking to buy a piano accordion. Why? I just love the sound, they’re an intriguing and mysterious instrument to most people and I have a growing habit of buying interesting instruments then failing to learn to play them. Still, a lot of the fun is in the chase, and I’m maximising my enjoyment of this one!

To that end, I’ve been devouring information about piano accordions online, though I’m still yet to actually touch one! Hopefully I’ll manage that later this week with a visit to a London music shop, but for now, here’s my ultra-condensed guide to what I think I need to know about accordions in order to make an informed purchasing decision. We’ll see if I was actually right.

  • Piano accordions can have different numbers of piano keys (right-hand) and bass buttons (left-hand). The ‘full’ set is 41 piano keys and 120 bass buttons.

  • The bass buttons (in a 120 bass at least) are laid out in 6 rows, with top two rows being single note counter-bass and bass, the the remaining four playing chords rooted on their associated bass note. So the left hand can play individual notes and chords. This is known as a Stradella bass system.

  • A free bass system just has lots of individual notes, so you must form chords manually with multiple presses at once. This is considered by some to be a more purist approach and allows greater musical flexibility, especially for the classical scene.

  • Some ‘converter’ accordions can switch between Stradella and free bass. I’d like one of those (I want the moon on a stick) but I get the impression they’re not so common and probably not cheap.

  • Speaking of cheap, though you can get small accordions (e.g. with only as few as eight bass buttons) for less than £100, it looks like you need to spend £400 or more to get a 120 bass accordion from a cheap Chinese manufacturer. £1500 will buy a half-decent Italian model, but the options just get more expensive from there.

  • Accordions are heavy – think 8Kg or more. They come with shoulder straps as a rule.

  • There is more than one way to tune an accordion, giving quite different types of sound. Tuning is a job for an expert (requires tweaking metal reeds) and probably done every five years or more, so best buy one that’s tuned well to start with!

  • It doesn’t matter how hard you press the piano keys or buttons – volume is controlled by your pressure on the bellows. Apparently this can be hard for a pianist to get to grips with, being more akin to bowing a cello.

I repeat: this is just what I think is true – I stand to be corrected, and will post an update as the story unfolds.