Author Topic: [Tutorial]Making Add-Ons With Blender(Not Modeling)  (Read 121375 times)

In this tutorial I'll explain pretty much everything you need to know on how to get your model ready to be scripted and put into blockland using blender.
This does not include the interface and controls, if you want to learn on how to do that go here.

Also, this tutorial is for blender 2.46, you'll probably be able to follow along on 2.49 but it won't work on 2.5 and up.

This will teach you everything you need to know about having your model to work in-game, including the animations.

1. Introduction
2. Weapons/Items
3. Weapon animation(reloading etc.)
4. Vehicles
5. Player Animation.
6 Texturing

1. Introduction
Well first off I'd like to say that blender is NOT hard. Don't worry about all the buttons and controls, 90% of them you won't need to use for Blockland. Blender has the same way of modeling as every other professional modeling programs.
It is the interface that is different, and some more advanced programs like 3DS Max have a lot of effects to make complicated models a bit easier, but the basic modeling is the same in most modeling programs. You just have to get used to it. Extrude, scale, duplicate, rotate, etc. Some people prefer other programs though because they like how it works, its easier for them. That's up to you to decide which one you like better. If you want to learn on how to model with blender first this topic isn't for you, visit here:

IMPORTANT: You need the dts exporter for blender in order to get your models in-game. Download it here:

Place it in your BlenderFoundation/.blender/scripts/ folder. If you don't have a scripts folder it means you downloaded the zipped version of blender, download the installer and run it.

2. Weapons/Items

Alright, so in this section i'm going to show you how to put mounts on your weapons or items, and then exporting it into the game.

Start off by making sure your lighting will be fine, that means you shouldn't scale things in object mode. Ever, it makes your model way too contrasty. If you did don't worry, just select your model and press Ctrl+A, and apply scale and rotation.

Next, make sure your handle or whatever is the right size. The minifig's hand is about 3x3 small cubes wide and high. When you first start up blender you see some large squares on the grid and then small squares inside those, about 3x3 of those small squares.

After that, make sure your model is facing the right way. When you press 1 to go to front view the model should be facing the opposite way from you. If you experience backwards lighting in-game, its an easy fix. Just rotate your model 180 degrees in object mode, then rotate it back in edit mode.

Once you're finished that, you're ready to put mounts and export into the game.

Press space bar, go to Add> Armature. Make sure you're in object mode. Then put it to the spot where your guy will hold it. And rotate it 90 degrees, like so:

(Its zoomed in, so the 3x3 squares i told you about are bigger, the tinier ones are just the ones inside it. And as you can see the handle fits good)

Now to name it, go into edit mode with it selected and select the bone. Not the little ball at the tip the actual center, and press n. Then where it says Bone: Bone rename that to mountPoint. I like to name the object as well so that when i click on it i know what it is automatically but thats up to you, you don't have to name it in object mode.

If you want a muzzlePoint, duplicate the bone(shift+D) and put it over at where your going to shoot out of. Then rename the bone to muzzlePoint.

Next, press spacebar and add a new empty. Call it Shape. After that Make another empty and call it detail32. Parent your mesh(ctrl+P), and all your bones to Detail32 and parent Detail32 to Shape.
This is the level of detail, i'm not going to go into detail about this since you don't really need to know more about it, just do this every time you make an add on or else it won't show up in 3rd person.

Now, assuming you have your torque exporter installed go to file>export>Torque Shape.

3. Weapon Animation

All the animation you do for blockland, you have to animate bones. You can't just animate the mesh because it will not work, your mesh has to be parented to a bone and the bone is the one being animated. No matter what it is.

Add a new armature, and place it near the object you're going to be animating. Then click on the armature, and hit ctrl+tab to switch to pose mode, or you can use the switch at the bottom of the 3D view. Then, select the model you're going to be animating and hold down shift and select the bone so that they're both selected. The bone should be blue, because you're selecting it in pose mode. Then hit ctrl+p and click parent to Bone. This way your model will only follow that bone and won't deform.
Parent this bone to detail32 also.

It doesn't matter what those bones are named, and they can all be in 1 object.(Not the mounts, all the bones that you will be animating.)

Now we need to open the action editor so we can see the keyframes and rename our animation.
So right click on the part that divides the 3D view and the buttons view, and click split area. Then click somewhere in the 3D view to split it, like so:

Then click on the button at the side and select action editor

Now, select your bone that you're animating(make sure you're in pose mode) and hit I. Then select either Loc(to keyframe location) Rot(rotation) or Scale(duh). Most of the time you won't be animating scale, so hit LocRot. You'll see a yellow diamond pop up on the action editor, and a new sequence called Action.

The diamond is the keyframe. Now either click and drag the green line across the action editor to go to the next frames or use your arrow keys. Up is up 10 frames, Down is down 10 frames, and the right and left are to go up and down 1 frame.

Skip a couple of frames then move your bone to another spot, and hit I and LocRot again to set another keyframe.
Now you can move your armature to the place you started manually but if you want to be exact, select the first keyframe in your action editor(same way, a to select and deselect all, b to drag a box) and hit shift+D to duplicate it. Then move it over to the frame you want to stop on. To play it back press alt+a(esc to stop)
Congrats, you have animated something in blender! But we're not done yet, we need to export the animation. Also, if you want to rename your animation click the box that says Action, and type whatever you want.
So click export to Torque Shape and go to the sequence tab.
Then hit export on the sequence you want to export and just export your model. Now your model will animate in-game. When you want your animation to play, is up to the script.

4. Vehicles

There's not too big of a difference here, just collision and the mount names.
The mount names for the seats are mount0 for the driver, then mount1 and on for the rest. Works thesame way as mountPoint, so if you didn't read that part and just skipped to here make sure you read it. I'm not going to type it over again.

The mounts for the wheels are hub0 and hub1 for the front 2 that will turn, and then hub2 and on, for how many you're going to have.

Now, for collision. This has to be a low poly outline of your model, preferably just a cube. And in order for it to work you must make a new empty and name it Col0. Then parent your cube to Col0 and parent Col0 to shape. If you don't know what i'm talking about go to the weapons/items chapter.
Make sure you name your cube Col, I don't know why but the game will start complaining in the console that it needs to be named Col, or LosCol. It does no harm but people don't like having console spam in their console.

This cube will not show ingame because it is not parented to Detail32.

Animation also works thesame way here as I explained in Weapon animation chapter. So if you want a propellor to spin or something. Mounts can animate too, just to let you know. So you can have fun with that, I know I did.

5. Player Animation

There's 2 kinds of rigs you can make, one that deforms and one that doesn't.
Obviously the one that deforms is alot harder, because you have to have your model clean in order for it to work properly. The messy one will have alot more deformation problems than the clean one. Obviously.

If you want to make one that doesn't deform, like the blockland minifig you seperate the hands,body, whatever into different objects(selecting in edit mode and pressing P) and then parenting them to separate bones(like i explained in weapon animation).

If you actually have legs and arms and everything is connected, you have to parent the model to the bones and then click create bones from heat.
There's other ways too but I use this method. For this, you'll have to do some weight painting which determines how much of the body each bone effects.
Learn more about weight painting here.

Now, you should start rigging your model. Its quite easy actually, just make a new armature and place it somewhere in the middle of your mesh. Then go into edit mode and start extruding into the arms and legs.(Same as modeling, E)

Once you're done that either parent by creating bones from heat or if it doesn't deform then parent each object to individual bones.

Now you need the mounts, all the ones i know right now is mount0 for right hand, mount1 for left and mount6 for head.(hats) Don't know the one for the brick tool so if you do post here. I would suggest naming the bone that the hand is parented to mount0, so that everything you animate when you hold a weapon it'll follow automatically. Just move the bone in edit mode abit over so its not in the hand.

70% chance your going to animate it, then when you test in-game the mount is flipped, there really is no telling if the weapon is going to be sitting correctly in his hand. If its a simple model that you didn't really have to weight paint you can just unparent the hand from the bone, flip the bone then parent again. (You can't flip the bones in edit mode).

But if its something more complicated and it takes a while but you don't want to completely re-parent there's a solution. Go into edit mode and add a new bone, and place it where you want your mount to be. Then go down into the editing menu in the buttons window and while having the bone selected, make it the child of the bone that you use for the hand.

So now, you can turn the mount anyway you want in pose mode and it will always follow the hand bone, no matter where you move it. If you move the arm it moves the hand(because when you extrude they automatically parent to each other) and the hand moves the mount.

Now you should animate it, and you already know how to animate from the weapon animation chapter. I to keyframe and use the action editor to move keyframes and rename your animations. Key to animating is not just going frame by frame and moving it, it is to make a few poses every 10 frames or however many you want to skip, and then insert the breakdown in between those poses.

So pretty much adding more detail, for running you start out with your right leg back and your left leg front. Then switch, but if you play it back its just him transitioning his legs. So if you go in between those 2 poses and maybe make his right leg a bit bent, it'll already start looking better.

Now, once you animated it you should name all your sequences and do the regular Detail32 and Shape routine. Except parent the bones to detail32, the model will be parented to detail32 through the bones.
You don't need Col0 here though, player type collision is controlled in the script. The bounding box part.

Now once you're done all that its time to export.

The big thing about player type sequences is priority. Priority determines which animation is more important. For example you should have your armready animations have more priority than run. Because in run you have your arms swinging, but when you take out your tool you want to play the armready animation, and if the priority of the armready is lower than run, the arms will just continue swinging.

You have to play around with these, and you have to be careful not to have thesame priority of some animations, like for example the headside and look don't really matter, because they use different bones and they can be played at the same time. root and run must have different ones, because they use thesame bones.

Once you've played around with the priority you should go into the action tab and select DSQ for them all, so that they export in a seperate DSQ file. Then choose which sequences you want to loop. You should have the movement ones like run, side and back loop. As well as the crouchrun,side and back.

When you're all finished, go into general tab check off triangle strips and you can export! You're finished and you can now use it with a script! This was probably the most confusing chapter of them all.

6. Texturing

I thought i'd just stick this in here, for people that model in a different program but want to use blender for putting it in-game.
Texturing is simple, split your view and choose UV Image Editor

Then change the draw type to textured

Choose the faces you want to texture, then go into the uv image editor and choose image>open. And pick your picture, and it'll automatically texture it. You don't have to load thesame picture over and over again, if you already loaded it and you have some different faces selected, click on the up and down arrow in uv image editor and select the image that you loaded.

Now, if you want to load a detailed picture onto a side but the side is all subdivided and has lines going through it, the easiest way would be to unwrap it. Press u in edit mode while having your model selected and choose the way you want to unwrap.

Well i hope this helped some people, yes it might sound confusing at some parts but this is the easiest way to explain it. If you're still completely lost don't try this.
If you have any questions post here.

Credit to Racer for teaching me about priority, triangle strips and how to fix the lighting.

Helpful links i mentioned in topic:
Basic Interface
Tuts provided by Blender
Weight Painting.
« Last Edit: October 28, 2015, 11:02:42 AM by Badspot »

Holy stuff nice.. When i begin to work with blender again.. i will use this as reference. Thank you.

I just realized, people have all the exports by default. Might've been just me because i only had 3 and when i installed the smd export they all popped up. And i thought it was because of that.

...I should lock my topic now. Thanks!  :D

EDIT: you might want to add that if there's a document with the same name in the target folder, the .log will be blank and it will be weirded out.  :P
« Last Edit: April 23, 2009, 04:55:54 PM by GhostOfBetaTapes »

I can never get the DTS exporter to work.......

I can never get the DTS exporter to work.......

Download latest Python engine from Get the DTS exporter. Run the PC python script into the Blender Plugins directory. Hopefully, you did it right, and it's done.

For some reason, my Blender only works when I have an older version of Python, And I don't want any more of that crap on my computer... I can't model anyway.

Wow, this is nice! I've never used Blender before, but this will really help when I do use it . :3  Thanks!

I can see a little more addons made with blender.

Can you post a .blend file for that hand in the first picture?

its a nice tutorial but you might want to rename the topic because all i see is modelling, and no scripting ;)

its a nice tutorial but you might want to rename the topic because all i see is modelling, and no scripting ;)

There's nothing in this tutorial about modeling anything. It's about how to do other things with the models you've made, with Blender.. Such as animation, exporting, texturing, lighting, ect...

this really helped, thanx!

Somebody sticky this?

EDIT: with the "Now, for collision. This has to be a low poly outline of your model, preferably just a cube. And in order for it to work you must make a new empty and name it Col0. Then parent your cube to Col0 and parent Col0 to shape. If you don't know what i'm talking about go to the weapons/items chapter." bit, do i have to add the detail32 and everything? or just the shape?
« Last Edit: May 12, 2009, 03:48:12 AM by Quintano Man »

Can you post a .blend file for that hand in the first picture?

Here's the blend for the whole minifig.

EDIT: with the "Now, for collision. This has to be a low poly outline of your model, preferably just a cube. And in order for it to work you must make a new empty and name it Col0. Then parent your cube to Col0 and parent Col0 to shape. If you don't know what i'm talking about go to the weapons/items chapter." bit, do i have to add the detail32 and everything? or just the shape?

Yes.. Col0 is just for your collision mesh, you still need detail32 for your bones and mesh.
« Last Edit: May 12, 2009, 06:02:09 PM by DarkStar »