About fish, weed, hooks and tentacles

Posted by
April 29th, 2014 3:19 pm

Beneath the surface: my first though was digging, the second underwater. Then I remembered the Beatles song “Yellow Submarine” and it was clear: I do a submarine treasure hunt game. You can try it here! For this Ludum Dare I wanted to put an emphasis on creating an immersive environment, so this is what I did (read: “tried”).


post mortem fish

Some years ago I experimented with swarm behaviour and there is even an algorithm called particle swarm optimization which I used once. A quick 3D model of a fish with Blender a uniform orange material and we have a fish GameObject. Then a second GameObject for the swarm which moves the fish in sync. Each fish is pulled towards to the common swarm goal and pushed away from other fish in the swarm – ready.


post mortem weed

While the ocean floor is actually extremely empty down there (did you see that ghost shark!), I figured some plants would look nice. First I tried a blender model, but quickly switched to procedural generation. Weed is created dynamically in batches of around 100 halms. Each halm is created as simple pyramid with 3 radial and height segments. At each height segment there is noise added and the halm bends a little to created the rigged effect.


Now how to pick up treasure from the floor. A hook for grasping and pullingĀ the treasure in would be nice. But how to do that in Unity3D? After some failed atempts I created a spring joint on the submarine object which is attched to a hook mesh. If the “Max Distance” property of the spring joint is increased/decreased the hook is lowered or pulled in. To pick up objects I use a dynamically created “Fixed Joint” to connect the grappeld object to the hook. The rope is a dynamically created cylinder where one end is on the submarine and the other on the hook.

post mortem hook


Motivated by the hook physics I aimed for something bigger: evil tentacles which grap your submarine and drag you down. I used four cylinders connected with hinge joints, a fixed base cube and a sphere as a endeffector. But moving the endeffector in a controled way from A to B is not a trivial task. The tentacle tends to mess up and get stuck in itself. Time for someĀ math magic (line 136) and please don’t ask… In the end the tentacle gets stuck sometimes, sometimes it moves a bit erratically, but in total I am quite satisfied with the result.

It can hoard treasure too:

post mortem tentacles

You can play my entry here! Please let me know what you think in the comments!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]