Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Blender to Sandbox Part2 Animation

Learn more on how to use Sandbox, or submit your own tutorials or resources.
Post Reply
User avatar
Dunstan
Member
Member
Posts: 7
Joined: January 20th, 2011, 7:32 am
Name: Bela Selmeci
Location: Budapest, Hungary
Contact:

Blender to Sandbox Part2 Animation

Post by Dunstan »

Blender to Sandbox - Creating animations

Here is a small step-by-step tutorial about creating animated models in Blender. In this Enter (Ent) means, that you press the Enter key, which is an important step after rotating, moving or resizing. This tutorial assumes, that your positional (cross-hair) cursor remains at the default center location until otherwise indicated. This tutorial presumes that you have already read and understand Daniel_San's tutorial about creating models in Blender.

To create a plain door, first let's create a doorframe. You'd better use doorframes, because if you do, you don't have to be too precise in resizing your model, part of the frame can be in the wall.

First, resize the default cube to 1x1x1: S 0.5 Enter. This step is optional, it makes easier to calculate values. For the sake of safety, press Ctrl-period, to change to object-centered mode. Now duplicate the cube, and move the duplicate to 3.25 along X: Alt-D X 3.25 Enter. Now right click on the original cube, and again duplicate it: Alt-D X -3.25 Enter. Scale the new post: S X 0.5 Enter S Z 10.5 Enter. Do the same with the right cube. Now select the central cube, and scale it: S Z 0.5 Enter S X 6 Enter, then move it to position: G Z 5 Enter. Select all objects by pressing A or right_clicking on them while pressing Shift. Join them by pressing Ctrl-J. Now follow Daniel_San's tutorial about naming, triangulating (in Edit mode press Ctrl-J) and texturing the doorframe.

You can create this doorframe in edit mode by extruding vertices, too, but it is a bit more difficult, and the result contains only four vertices less.

The door itself: press the spacebar, add new mesh cube. Resize it to fit into the frame: S x 2.9 Enter, S Z 9.9 Enter, S Y 0.2 Enter. Move it a bit downward: G Z 0.1 Enter. Your door is finished, name it, triangulate it, and texture it according to Daniel_San's tutorial. Now a door-knob: press space add new mesh cube. scale it to 0.1: S 0.15 Enter, then scale it to 5 along Y axis: s Y 5 Enter. Now using the front view (press 1) move it with the coloured arrows to the position you like. To add a knob, use space add new mesh icosphere, with the radius of 0.25. Move it to the end of the shaft by G Y -0.5 Enter, then duplicate it Alt-D Y 1. On my model, I used cylinders to have two handles, you can make it similar to the icospheres. Select all three items, join them with Ctrl-J, name it as "Knob", then switch to Edit mode with Tab. Triangulate (Ctrl-t) and texture your handle according to Daniel_San's tutorial, but use some metallic texture for the knob.
Door in Blender
Door in Blender
When you create the md3.cfg file, don't forget, that you have three parts, so the config file will contain three md3skin rows:

Code: Select all

//skin model 
md3skin Frame Mahogany.jpg 
md3skin Door Mahogany.jpg 
md3skin Handle Brass.jpg 
You can create the frame of a sliding door this way (Ent means Enter): S 0.5 Ent, Alt-D X -3.25 Ent, S X 0.5, S Z 10.5 Ent, right click on original, Alt-D X 3.25 Ent, S Y 0.3 Ent, S X 0.5 Ent, S Z 10.5 Ent, G Y -0.35 Ent, Alt-D Y 0.7 Ent, right click on original, S Z 0.5 Ent, S X 3.5 Ent, G Z 5 Ent, G X 0.25 Ent. Now Join the four parts of the frame, then proceed with the door. When animating, follow the procedure for animating the button.

To create a simple switch button, use the default cube, and scale it to 0.05 along the Y axis: S Y 0.05 Enter. Name it and triangulate/texture it according to Daniel_San's tutorial as "Button-house". Press spacebar, add new mesh cube. Scale it to 1x1x1: S 0.5 Enter. Scale it again 0.5 along the Y axis: S Y 0.5 Enter. Move it towards you along the Y axis: G -0.25 Enter. Name it, triangulate it (Ctrl-T in Edit mode), and texture it according to Daniel_San's tutorial. Your button is done. You can create a circular button by using cylinder instead of the second cube.
You can create a pressure plate by resizing the original cube: S X 2 Ent, S Y 2 Ent, S Z 0.2 Ent then name it as Plate, texture it using the floor texture you want to use, and triangulate it. For circular pressure plates, use a cylinder instead of the cube.

Now, let's animate our models. After you are done with the texturing, and everything is all right, do the following:

For the door (rotating animation):

First, select only the door (or every moving parts, like the door AND the knob) by right-clicking on it (use Shift for multiple selections). Left click on the place of one of the hinges. Press C to center on it. Zoom in to a bigger magnification, and click exactly in the midle between the door and the frame. It is not important, where do you place the cursor along the doorframe, as long as it is in the place of the hinges horizontally. On the buttons window, where you have given the name to the objects, find Center Cursor. The three-color cursor will move to the point selected. With this, you have moved the rotation axis, which always crosses the coloured cursor.
blender-center-cursor.jpg
Change the Buttons window to the Timeline. Find the "End: 250", and change 250 to 30 (or 15, this is the total frames of your animation). Move to Frame 1. Push Insert keyframe, and select Rot to add a rotational keyframe. Now click on the Skip to end frame button, then go up to your door. Change to top view by pressing 7, then turn the door (and other accessories) along Z axis by pressing R Z, then turn the door to the open position with your mouse (or use a degree, as you like). Go back to the Timeline, and again add a rotational keyframe. Now, if you click on the Play timeline button, your door will open continuously.
blender-door-anim.jpg
You can create and animate double doors, too, simply repeat the steps of centering cursor, adding rot keyframe, rotating, then adding second rot keyframe, while the other side of the door is selected.

For the button (or sliding door, Location animation):

Go into side view (3) or top view (7). Select only the button by right-clicking on it. Change the buttons window to the Timeline. Find the End: 250, and change 250 to 10. Ensure, that you are in Frame1. Push Insert keyframe, and select Loc to add a locational keyframe. Now click on the Skip to end frame button, then go up to your button. Slide the button along Y axis by pressing G Y, then use your mouse to pull the button to pushed state (or use a value that is less than the button's thickness). It is not interesting if your button comes out on the backside of the button house, since it is on the wall, but if you don't like it, go back, and change the thickness of the button or button-house. Go back to the Timeline, and again add a Loc locational keyframe. Now, if you click on the Play timeline button, your button will be pushed in continously.

Pressure plate (Scaling animation):

To animate the pressure plate, follow the steps of animating the button, but instead of using Loc keyframes, use Scale keyframes. After you have placed the first keyframe, go to the last frame of your animation, then move the coloured arrows cursor to the bottom of your plate. Use the S Z 0.2 Ent command to press your plate, then put another Scale keyframe into your animation.

You can use combined animations of rotation, location and scale, by selecting the appropriate keyframes.

To export these models from Blender, first go to the end frame of the animation (if you don't do this, your animation will be missing!), then select all objects, and export your animation to md3. In the Sandbox config file, the following lines will determine the animation of your model:

Code: Select all

md3anim mapmodel 1 1 
md3anim trigger 1 10 15 
where the line with mapmodel describes the animation in the default state of your model, the line with trigger describes the triggered state (when the triggering event happens), the first value is the starting frame of the animation, the second value is the number of frames, the third, optional value is the framerate (in the first case it is the default 10). Now fire up Sandbox, add the model according to Daniel_San's tutorial, then set the model's trigger to 10 (door) or 5 (button). In FPS mode your model shall move when you go near to it. For more information about triggers, read this, for more information about configuring model animations, read this.

If your animation is missing, you may not have triangulated all parts of the model, or you haven't forwarded your animation to the end frame before you have exported it.

Using the models in different sizes and with different textures

You can use md3 models with different textures this way: Create a directory in models for your model files. Put your md3 file there. Create subdirs in this directory for every size and texture you want to use. Put your md3.cfg-s into them, along with the textures. Your md3load command must be modified like this

Code: Select all

md3load ../tris.md3
where tris.md3 is the name of your md3 file.

You can create animated models, which function as hidden doors. For example, create a crate according to Daniel_San's tutorial, then animate it to slide away one lenght, thus revealing a secret entrance. You can trigger this behaviour by pushing a button or stepping onto a plate (add trigger 11 to crate, trigger 5 or 6 to button or plate, and the same level_trigger to both). Also you can create animated locks, etc.
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Blender to Sandbox Part2 Animation

Post by chocolatepie33 »

wow, nice work there. maybe you could work with Dan to make the ultimate md3 tutorial, using blender.
Dunstan wrote:You can create animated models, which function as hidden doors. For example, create a crate according to Daniel_San's tutorial, then animate it to slide away one lenght, thus revealing a secret entrance. You can trigger this behaviour by pushing a button or stepping onto a plate (add trigger 11 to crate, trigger 5 or 6 to button or plate, and the same level_trigger to both). Also you can create animated locks, etc.
I've never, EVER, thought of doing that. You, my friend, are a genius.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
Post Reply