DISCLAIMER: It is super important to read this documentation. Beta tests have shown that people are truly clueless without it. If you plan to actually make something with this engine, you should really read this, even if just briefly. Glue3d is a full game engine built entirely within the scratch programming language. It has many features, such as textured rendering, model editing , bone keyframe animations , scripting , file management , as well as exporting a final build of your game. In order to use glue3D, you must be familiar with the all the parts of its main screen . Main bar: Used to access file settings, quick edit s, run your project, import pre-made templates, as well as the help menu. T ab selector: Switches between the script editor, scene editor, and model editor. T ool Bar: Access settings , create files , scripts , models , objects , and more. Inspector: View current objects and textures, and apply models and scripts to them. Scene: Direct window to your game : move objects in 3D , edit models, create and edit scripts, and do almost everything in this window. Side bar: View properties, change textures, and view block categories. File viewer: View and interact with your files, to move, delete, or create them.
Important information : The engine consists of 3 main elements. Objects, Models, & Scripts. You also have other elements, such as files, textures, cameras, UI elements, Bones, and more. The 3 main elements: Objects : Similar to “Sprites” in scratch , Your building blocks in the scene. Everything in your game is an object. A player? That’s an object. A floor? That’s also an object. A projectile? An enemy? A chair? Anything in your mind. There are 2 types of Objects : o 3D (used for things that move, such as a player or an enemy. Only 3D models are supported ). o static3D (these are used for raycasting engines, to render static things like floors, walls, and tiles. Only fake-3D engines are supported). Models: Similar to “Costumes” in scratch. Every visible 3D object in your scene has a model. Models can be anything, from floors, to walls, to a human, to a car. Models have 4 main types: o 3D sprite (a full 3-axis 3d renderer, with all degrees of rotation. But accurate collision between 2 3D sprite objects isn’t supported. Can have keyframe bone animations.) o Advanced Map (renders fake-3D but very fast graphics, can render rooms over rooms, has super accurate collision with slope support, and has perspective accurate textures with clipping.) o Blocks (super-fast tile engine, renders fake-3D with accurate textures and physics, super easy to model with, but doesn’t support tiles over tiles.) o Floor texture (extremely fast fake-3D infinite floor renderer, supports textures.) Scripts: Just like “blocks” in scratch. Used to control your objects and bring them to life. Objects take scripts, and scripts control anything in them. From position, to the current model, to scale and rotation. Scripts can: o Edit position, rotation, and scale of an object o Edit Model and Bone of an object o Edit Variables and Lists in an object o Generate Files and Other data types, such as a model or another script. o Get values like Timer , Object data and File contents. Other important mechanics: Textures: Similar to the “fill tool” in scratch , instead of a single color however, we get to dress our models with custom images! Imported as txt files for 32x32 bitmaps. (You can check img2list for that) Files: Similar to folder groups. While not necessary to create basic games, it’s very important to organize your scripts and models, as more complicated projects tend to have a lot of them.
Lists: Just like “listsin scratch. Stored in files, and used to store and recall large amounts of data. Lists can be created in temporary files that get deleted when the project stops running, or in normal files, where you can save data even if the flag was clicked. Cameras: Just like in real life. Cameras can follow objects like a player, see from their point view, spectate from far away, go on tracks or act in a special way in cutscenes. You can have as many cameras as you want, but only 1 camera can be active at a time. Bones: Just like in real life . Applies only to 3D models. A bone can have a parent, and its parent can have a parent. This creates a skeleton like appearance. 3D models then take that bone, and depending on the group of each face, move along the skeleton, making them animate! Works alongside keyframe animations too. UI elements: Just like “Sprites” in scratch , 2D objects that can check if they were clicked, that take costumes as their appearance. Used to make things like buttons, or things held in the player hands. Configuration Guide: upon running the project, we are welcomed with a splash screen. Proceed, and you’ll stumble across something that looks like this: this happens when the engine isn’t configured yet. to configure the engine, click on the settings icon in the toolbar. You will see this screen pop up. This screen lets you choose the engines you’ll use in this project.
If you’re just starting out, click on the blue proceed button, located at the bottom right of this window. Click off the warning that appears, then click the blue button again. You should hear a special cheerful sound, and notice that the black background has changed into a cloudy blue one. The settings window consists of 6 main tabs (in order): The Engine tab: Configure renderer related settings, like resolution, field of view, render distance, skybox type, shadows, mipmapping, ambient occlusion, back face culling, and more. The User Interface tab: Change theme related settings, Like the skin, The font, the text and icon scale, brightness and contrast, and theme performance optimizations. The Data tab: View the size of the project, and format or mass delete specific parts of the engine. Be extremely cautious with this one. The File tab: Configure file related settings, like showing the amount of data in a file, showing the delete option or disabling it for caution, and greying out empty files, as well as selecting a main file. The General tab: Configure general engine settings, like clock speed and mode, and the option to include the splash screen. The Export tab: Export your game, and choose settings to edit when exporting it. Click off the window . It’s time to get used to the camera movement controls: You Move with the WASD keys. You Look with the Arrow keys. You Elevate with the Space and Shift keys. If you feel that the camera is too fast or slow, or that you want to show the coordinates, you can control these settings from the Main bar > Edit > Camera settings Extra information: the camera cannot go below the y: 0 point, and due to that engine’s code, it’s impossible to truly look down . It’s recommended to keep the camera pitched down in order to have easier visibility and range of control in the scene. It’s also recommended to have a field of view of 240 .
Before you can start making a project, you need to have assets loaded. Assets are split into 3 sections: Costumes : Anything 2D in your game, like a button or a logo. Place them in the costumes tab in the Scratch editor, but DO NOT: have spaces in the name, DO NOT have special characters other than “_” and “-“, and DO NOT have capital letters. Sounds: Your background music, sound effects, and player dialogues. Place them in the sounds tab in the Scratch editor. but DO NOT: have spaces in the name, DO NOT have special characters other than “_” and “-“, and DO NOT have capital letters. Textures: These are the most important here. For a first ever project, you can just load in the basic textures. Go to Import > Basic textures. This will load in a colorful checkerboard type texture pack. However: if you want to import your own custom textures, then it’s a longer of a process, involving creating a file on your own computer and using online tools: o Step 1 : Create a folder on your computer (NOT glue3D), and name it textures. o Step 2: Copy all the textures you want to use into the folder. o Step 3: We need to resize all images to 32x32. Use a batch image resizer like Redketchup to automatically resize all your images at once. Do not maintain aspect ratio, and if possible, choose nearest neighbor resizing. o Step 4: extract the Zip file into the textures folder, and choose replace all”. You will have a folder with all your 32x32 images now. o Step 5: Go to img2list (GitHub tool), choose decimal combined RGB, and upload all your textures at once. The output will be a txt file with the color values of your textures. o Step 6: go to glue3D, File > Import texture. The popup on the right will appear. Right click the list, choose import, then select your textures .txt file. Click off, and now you have loaded your textures. you will have successfully imported custom textures.
For an error free run, let’s also create a camera before anything else. Press the “h” key to go back to the origin point, and move slightly backwards, while staying perpendicular to the blue line. Elevate a little and look down. This will be our initial camera’s position. From the tool bar, scroll horizontally until you find the camera tool. Click on it, and name your camera, camera”. If you decide to name your camera anything else, you need to let the program know that this is the active camera. Navigate around your scene and find your camera object. Click on it, and select the last option in the menu that appears, “assign camera”. That’s it! Two really important rules: never share 2 things with the same name in glue3D. this includes objects, files, scripts, models, cameras, UI elements, bones, lists, editor groups, and textures. Never name conflicting names too, such as model, script, object, camera, texture, variable, list, or anything that the engine uses. If you’re unsure, add numeric characters to the name, model becomes model01, script becomes script01, to avoid conflict with the engine’s internal code. Basic setup is done. What now? Let’s get something rendering! First of all, let’s start with the floor. Getting a floor rendering in glue3D is one of the easiest tasks possible. Start by clicking on the object tool in the tool bar. Name the object “floor”, and set its type to “static(3d)”. then proceed. Next, find and click on the model tool in the tool bar. Name the model “floor01”, and set its type to “floor texture”. Now proceed. You will notice that a model icon has been created in your main file. We’ll start by organizing this place. Create a file and name it models. (MAKE SURE TO NOT NAME IT ‘MODEL’ ) click and hold on your floor01 model, and carry it into the models file, located in the bottom left. Once you’re hovering over it, release, that will move it to the new file. We will create all our models inside that file, and we’ll keep all the scripts in main . This way, we can quickly find the game’s assets. Now, switch to the model editor tab (you’ll find a model icon located at the top right corner.) once you’re in the model editor, simply click and hold your model, and drag it into the black screen area. Your “floor texture” model will load.
Customization: From the sidebar, simply scroll and click on a texture you like. The engine will automatically apply it to the current floor texture. You can always change the texture, and it will automatically apply to your scene’s loaded “floor texture” model. Here, I’ll go with the gray texture, “basic 15”. Navigate back in to the scene editor (you’ll find the camera icon in the top right corner). Once you’re back there, Locate the models folder. Once you’re viewing it, click and drag your “floor01” model, and release it on top of the “floor” object in the Inspector list. Congratulations, you’ve created your first 3D scene here. In the main bar, click on Run > Run program, and you’ll run your project. If you got a similar result, you’re on the right track. If you got an error however, stating that there is no camera in the scene, Like the one on the right, then you might have forgotten to assign the camera, or you haven’t made one yet. Follow the steps from before:
For an error free run, let’s also create a camera before anything else. Press the “h” key to go back to the origin point, and move slightly backwards, while staying perpendicular to the blue line. Elevate a little and look down. This will be our initial camera’s position. From the tool bar, scroll horizontally until you find the camera tool. Click on it, and name your camera, ”camera”. Let’s get familiar with the model editor. Create 3 more models, inside of the models file: Model named “tile01”, set its type to “blocks 50x50”. Model named “segment01”, set its type to “advanced map” Model named “box”, set its type to “3d sprite”. Let’s start with the simplest, “tile01”. Navigate into the model editor, and drag the model’s icon into the black screen. An empty tile editor screen should appear. The tile editor has 10 tools: -Select: Selects a tile. -Delete: Deletes a tile. -Tile: Creates a tile -Copy (value): Copies (value) of the selected tile -Change (value): Changes (value) of the selected tile How to control 3D cursor in the Tile editor: your 3D cursor moves with a combination of your mouse and keyboard. Your 3D cursor moves along the X and Z axis based on your mouse’s X and Y axis. To control the Y axis of your 3D cursor, Use the Q and E keys. To control your cursors Height (not to be confused with Y position) Use the Z and C keys. Your 3D cursor also follows you. If you cannot reach something, just move forwards and the cursor will move along. To place a tile, Select the tile tool in the toolbar. Select a texture from the sidebar, then move your 3D cursor into the position you want to place the tile in, and click. That will create the tile for you. You can also hold and drag, to continuously create tiles as you move. Important: It should be noted however, that you cannot place 2 tiles on top of each other. This limitation is only present in “Blocks” type models.
Cool ideas you can try building in “blocks” type of models: Tiles can have textures, surface textures, 3D shadows, accurate physics, and a somewhat customizable UV and offset. Now, let’s get to know the Advanced Map model type. Drag the “segment01” into the model editor to start editing it. You should see this screen appear: The Advanced Map model type uses 2D Line Segment Raycasting (Seg2D), to Render more advanced polygons. It supports much more accurate placements, n-gons, Slope rendering and physics, and surface and wall perspective accurate textures, and even rooms over rooms (For the doom nerds) It is important to understand that however, it is still in reality a 2D line map. That means that things such as slopes on the 3D axis need a special trick to work, as well as being affine texture mapped Select: A 2D line projected from the player to intersect with current line segments and select them. It will pick the closest y position if walls were overlapping. Segment: Important Creates a 4-point (in reality 2-point) wall segment, that can be textured and sorted into a group in order to create more complicated shapes (Note, the segment is always stay vertical, just like in Doom or Duke3D) Divider: Nothing scary or complicated, just an invisible wall with no collision that’s used to split n-gons into simpler shapes, to get a sharper and more accurate look. Group: Important Let’s say you want to create a box with a Surface on top. It’s impossible to do that with just segments. This tool assigns every following segment with a group ID, and segments with same segment ID’s fill surfaces between them. (WARNING: DO NOT have 2 different shapes(not segments) with the same group name, this will result in rendering problems!)
Texture repeat x: A number that represents how much the texture is repeated on the U axis. An input of “2” will draw the texture twice in the same space. Texture repeat y: A number that represents how much the texture is repeated on the V axis. An input of “2” will draw the texture twice in the same space. Surface texture: A number that represents the surface that will fill between shapes. To choose the green bush for instance, type in “9”. It is also important to understand how the 3D cursor works here. It is similar to the 3D cursor in the Tile editor, but with a few changes to work with the line segments better: Movement is same, you move the cursor on the X and Z axis with the Mouse’s X and y axis. If you move with the WASD keys, the cursor also moves along. Elevation Is same with an added control, you can move the cursor up and down with Q and E, But If you hold the C key, you can control the cursor’s Y position with the Y of your mouse and current Y position. Using the C key method rounds the Y position to the closest 0.5. Precision: Because you’ll make things that are over the floor grid, it becomes hard to position the point correctly. The V key draws a perfectly vertical line that shows where your point is on the floor grid, which is extremely helpful for making almost everything. Undoing: To undo, you can use the “` + z” combination. It undoes the last made segment, be careful with this experimental feature however. Here is a simple guide on how to create a simple box: o Step 1: Load your “segment01” model into the editor. o Step 2: Use the group tool, and set the group to “box1”. Don’t forget to set the textures. o Step 3: press “h” to go back to the origin point, and move backwards a little. o Step 4: the dimension of our box will be 2x2x2. Click on the segment tool, and position your point at exactly the top right corner in the grid, as shown in the image #1. Make sure that your y position is -0.5 too (the lowest y.) o Step 5: Double click, you will hear a special sound. Move your mouse to the top left corner, and click. This will show a red line, like in image #2. o Step 6: Using the C key, Raise the y to 1.5. You will notice that the wall always stays vertical. Click twice, and you will have a finished wall segment. Repeat that 3 times for each side. If all the steps were done correctly, you will have a box as a result. However, if you mess up during making the points, you can simply click the select tool to cancel making a segment. If you have already made the segment, then you can simply just “` + z” to undo.
Let’s make a slope next to the box. It’s very important to change the group of the next segments, however: o Step 1: Make the group for the next segments “slope1”. Let’s also choose a texture. o Step 2: Create the tallest segment in your slope, set the height to 2. Move it 2 grid cells away from the blue line. o Step 3: Create the shortest segment in your slope. Set its height to 0.5. Move it 2 grid cells away too, but in the opposite direction from the tallest segment. Keep it parallel to the tallest segment. o Step 4: Connect the tallest segment with the shortest segment, using 2 sloped segments. If you followed the steps correctly, you’d end up with a texture mapped slope like the photo on the right. Since the slope is affine mapped however, some distortion might be noticed. The slope supports physics and collisions too. If you have any rendering errors, you might want to check if both the box and the slope shared the same group. You might also have gaps, which completely glitch the surface renderer.
Finally, it’s time to learn how to use the 3D sprite editor. The 3D sprite editor uses quads and triangles to create very simple, and actually fully 3D models. It has affine texture mapping, no clipping, and no collision. That’s why you shouldn’t make your map with it. It’s suitable for player models, cars, enemies, projectiles, particles, simple map components (like a chair or table), (Note, you can collide a 3D object with static3D objects, but you cannot collide two 3D objects together. You can however, as we’ll see further, create fake collisions that work for simple use cases with the distance block in scripts.) The 3D Sprite editor’s 3D cursor works exactly like the Advanced Map one: Movement: the cursor X and Z axis us the Mouse’s X and y axis. If you move with the WASD keys, the cursor also moves along. Elevation: move the cursor up and down with Q and E, and holding the C key can control the cursor’s Y position with the Y of your mouse. Precision: The V key draws a perfectly vertical line that shows where your point is on the floor grid. Undoing: To undo, you can use the “` + z” combination. The major difference between 3D sprite and Advanced Map is that you can truly create 4-vertex shapes. So, no need for weird tricks to get a slope, you can just make it right away with one quad. To make a triangle, you can also just double click when you make your 3rd point, and it will automatically become a triangle. Another key difference, is the ability to animate the faces, unlike the static Advanced Map. To do that, you need to create your bone file first. Let’s start by finding the bone icon in the tool bar, and creating a bone named “testanimate”. This will be really important to animate later on. Drag your bone file into the model editor now, to edit it. Choose the vertex option. Set the value as “chest”. Increment your cursor by one step (half a cell) on the red axis. Then, using the C + V buttons combined, raise your bone into the y 0.5. Click, and you should now have a bone that displays “chest” when you hover over it. Now click back on the model editor icon. This will bring you back to the model editor empty screen. Drag your box model into the screen to edit it.
We’ll make a box with an opening animation, like a chest. Start by creating a base for the box. You’ll notice that you can move the point freely even after you’ve made your initial 2 points, unlike the advanced map mode. Please make sure to make the base 2x2. Now, make the 4 vertical faces of the box. Make sure that the y position of your cursor is 0.5. You’ll need to be more careful with holding the C key now, since the points can move freely even after you’ve placed your initial points. Repeat this for 4 times. For the lid of the box, choose a different texture. Now, find the “show bone file” tool in the tool bar (the last tool in the segment editor as of now,) and click on it. Set the bone file to testanimate. The bone from earlier should show up, and a message should inform you that it has been loaded. Hover over the bone with your mouse to check, it should say “chest”. Now, go to the “bone” tool in the toolbar. Click on it, and type in the name of the bone, “chest”. This will make every face that has this bone assigned to it rotate with it, to create animations. Finally, let’s create our chest’s lid, place 4 points on top of the shape to cover it, and once you’re done, click back to the select tool. Click on the shape and check that it has been assigned to the “chest” group, from the select tools (the little rectangle that appears when you select something.)
Now, find the animation tab in the sidebar and click on it. You will see a green plus button. Click on it to create your new animation. We will aim for a simple opening and closing animation. Set the name to “animation” and the type to linear. Click on the bone we just created to select it. Every time you click on a bone, it will be selected. This is the keyframe animation window. It consists of: Loop button (middle left): Enables/disables looping of the animation. Bone rotation buttons (middle right): (from top to bottom) They describe Yaw, Pitch, Roll. The darker blue button on the right resets the rotation to 0, while the lighter one next to it sets the rotation of the bone to your mouse x., until you click again. you can move your mouse from the very left to the very right of the screen to rotate. Keyframe button (Middle bottom):This saves the current rotation of every bone (not just the selected bone), and when the animation plays, they all play in sequence. Delay button (Bottom right): Sets the delay to the next keyframe. Generate animation button (Bottom left): Generates the animation script for you! This script then is dragged into the object. Before anything, let’s start by saving the keyframe. This means our animation will start with the chest closed. Now, after you’ve saved the keyframe, you’ll notice that it appears on the timeline. Hovering over it will show the delay to the next keyframe. Now, click on the edit pitch button (located at the right of the ry section).
Now, move your mouse to the left until the angle becomes 120. Once it’s 120, click to set it to that. Now, click on the Star icon to save this second keyframe. Finally, before you import, click on “Loop animation” to make this animation play forever. Now, click on generate animation. It’s the button on the left of the star. This will place a finished script that was automatically generated for your animation. Navigate back into the scene editor, and create a new object. Name it, “3d-box”. Set its type to 3D. Once you create it, move backwards a little to view the sprite, and drag your newly generated script, as well as your “box” model into it. Now, navigate into the Main bar, and go to Run > Run project. You should see your box getting animated! However, what if you can’t see the box? What if that happens because you’re behind the camera? Well, simply step click the “toggle free cam” button. It’s located at the top right of the scene window. Now, you can move freely while your program is running. You might have also forgotten to apply your model or the script to it. The scene editor a at a closer look: In the scene editor, you have 3 main components. Scripts, Models, and Objects. The scene editor also has the scene window, inspector, and properties sidebar. When you create an object in the scene editor, its initial position is set to your current position (or the origin point if you choose that). However, if you want to move it after that, you can simply click on the model to view the transformation, rotation, and scale options. You can also copy the object, which will create a duplicate with the first 2 letters of your object and a random number after it. Your duplicate will follow your 3D cursor in the scene editor. The scene editor’s 3D cursor works similarly to the 3D sprite and Advanced Map one. Movement: the cursor X and Z axis us the Mouse’s X and y axis. If you move with the WASD keys, the cursor also moves along. Elevation: move the cursor up and down with Q and E, and holding the C key can control the cursor’s Y position with the Y of your mouse. However, the precision line key and the undo key don’t work here. To view an object’s properties, navigate into the sidebar, and click on the properties button from the selector. You can find properties like transformation, rotation, scale, name, model, bone, script, clock, and other debugging information.
Finally, you can create UI elements, which are objects, but are 2D. they work exactly like 3D objects, but instead of models, they get assigned costumes from scripts. More on then later. Important: You can assign (Drag ang drop) models and scripts from both the inspector and the scene window, however, assigning from the inspector doesn’t work with static3D objects or UI elements. Important: You can have as many cameras as you like, however, only one can be active at a time. Things like multiplayer split screen are practically impossible. Important: To prevent problems, you cannot copy objects while running the engine. The script editor: (or code editor) is the place where you create and edit scripts to control your world. Scripts don’t just control player movement for instance, they control win and lose conditions, enemies, interactive doors, collectables, UI elements, and basically everything. The only things that cannot take a script are static3D objects, however, even static3D models can be created and applied all within scripts. The programming language used within scripts is G3D script. It is a programming language that’s designed to work only with glue3D, and specifically for it. It powers your engine. G3D script is interpreted as of now, but a compilation build is a WIP. Even then, it is very fast and runs multiple objects at a time, with features to throttle or limit object clocks depending on their usage for maximum speed efficiency. G3D script has 2 modes. Text editing, and Block editing. However, the block editing mode is way more superior. The text editing mode needs to follow specific structure rules, and can easily be broken. Text editing was left out in the engine to let people edit things within code for debugging reasons, like commenting out and quickly switching signs or numbers. It is important to note, text and block editors use the same exact language. The only difference is the look and how you interact with both. If you learn the block editor, you will be able to use the text editor too. That’s why, we will be learning the block editor in this guide. The block editor splits the code functions into block categories. They can be accessed from the sidebar. The block 14 categories are: Object: Control position, rotation, scale, and another object related stuff. Physics: Access the inbuilt physics system, collision, and velocity. Model: Set or change the model, bone, or animate directly. Game: Use ready-made movement scripts and camera controls. Math: Calculations, interpolate, clamp, trigonometry, and string operations. Terminal: Print variables and text for debugging and more control. Variable: edit variables, set them, increase them, or get the reporter value.
List: A list system that can be stored in files, useful for storing large amounts. User Interface: The category to control the 2D UI objects. File: Access file operations like creation and moving all with scripts. Time: Get accurate clock values and delta timing reporters. Editor: Create and edit models, all with scripts. Useful for world generation. Sound: Play sounds, control mono/stereo sound, and create advanced sounds. Other: Has all control blocks, like if statements, forever loops, and wait blocs. Block categories all work together to create your script, while scripts work together to create your game. Blocks in glue3D work a bit differently than scratch. They have inputs and types: Inputs: the white round shapes inside your block. These are how you control your blocks. A block can have none, one, and all the way up to four as of now. Inputs can be anything too. It can be a number, a variable name, or a string of letters. Types: the colored round shapes inside your block. As mentioned before, inputs can be anything. However, you need to make it clear for the block what kind of input it’s getting, with types. Let’s start with the basics. 1. create a script, you can find the script icon from the toolbar. Name your script, “count”. 2. Next, create an object, and name it “countobj”. Set its type to “3d. 3. Drag your script from the file viewer into the inspector, and release it on top of the countobj” inside the inspector. This will assign your script to it. 4. go to the script editor, and drag your script into there. That will start editing it. The script editor has 2 main parts. The code area on the left, and the Block categories on the right. To add a block to your code area, simply drag it from the block categories. To change the category, click on the small icons on top of block category.
When you drag a block, the inputs will have name placeholders in them. I dragged a go to object block here: Notice that the inputs say “object” and “speed”. To put your own values instead, simply click on them. A popup will appear prompting you to write your own value: When you click the green button, or press enter, it will overwrite the older value. In this script, the count object will go to the object named “player”, at the speed of 1 (instantly). (Note, we never created an object named player here, but this is an example.)
Let’s now make a script that counts to 10, then prints “done”: The script first sets the variable “counter-01” to 0. This will create a variable in the object called “counter-01”, and assign its initial value to 0. Next, a while loop is defined. It will repeat everything inside, until the condition is False. So, while “counter-01” is less than 10, it will repeat everything between it and the first endwhile under it. Inside the while loop, variable “counter-01” is increased by “1”. This will automatically add 1 to the current value of “counter-01”, making it count up. We also print the variable “counter-01” inside the terminal. This will allow us to see the counting process happen. Finally, under the endwhile, we print “done”. This will only execute after the count is done. To see the terminal, Go to Run > Run project. You should see a little (i) icon appear at the bottom left of the scene. Hover over it, and the terminal will appear. The terminal can print numbers, variables, and strings. It will also print the object’s name when printing anything. The terminal is super useful for debugging: it can visualize hidden variables, and print debugging points to know when you’ve run certain code.
The object blocks: Go to: go_to(val x, val y, val z, val speed) Sets the object’s position to the provided x, y, and z. set the speed value to 1 for an instant position, anything higher will be a smooth transition. Go to object: go_to_object(str object, val speed) Sets the object’s position to the provided object’s position. set the speed value to 1 for an instant position, anything higher will be a smooth transition. Move: move(val 0, val 0, val 0) Changes the object’s position by the provided x, y, and z. Directional move: move_dir(val dir, val distance) Changes the object’s position by the provided distance, in the provided direction. Rotate to: rotate_to(val rx, val ry, val rz, val speed) Sets the object’s rotation to the provided x(yaw), y(pitch), and z(roll). set the speed value to 1 for an instant rotation. higher will be a smooth transition. Rotate towards: rotate_toward(str object, val speed) Sets the object’s rotation to point towards the provided object. set the speed value to 1 for an instant rotation. higher will be a smooth transition. Turn: turn(val 0, val 0, val 0) Changes the object’s rotation by the provided x(yaw), y(pitch), and z(roll). Scale: scale_to(val sx, val sy, val sz, val speed) Sets the object’s Scale to the provided x(width), y(height), and z(length). set the speed value to 1 for an instant scale, anything higher will be a smooth transition. Distance to object: distance(str object) Returns the object’s distance to the provided Object. The returned value is stored in the variable “data_return”. Clone: clone(str script) Creates a new object with the position, rotation, scale and model. It will run the script that you provide in the input. Delete: delete() deletes the current object. New attribute: new_attribute(str object, val name, val value) creates a variable in the object you provide, with the provided name and value. Get data: get_data(str object, str data) reads a variable in the object you provide, the returned value is stored in the variable “data_return”. Edit data: edit_data(str object, str data, val value) edits a variable in the object you provide, with the provided name and value Use object blocks to control position, rotation, scale, and to read and edit other object’s variables. It is an essential part of a good project.
. The physics blocks: Include physics: include_physics() Tells the object to include all physics related modules. Please make sure to use this if you want to add physics to your object. Set factors: set_factors(val gravity, val jump, val friction, val bounce) Sets the object’s physics related factors, which are gravity, jump, friction, and bounce. Set hitbox: hitbox(val x, val y, val z) Sets the hitbox for collision. width, height, and length. (Please note however that the y hitbox isn’t used for now) Surface collision: surface_collision(str true) tells the object whether to do surface collision checks or not. (Not to be confused with a surface collision check however.) Hitbox collision: hitbox_collision(str true) tells the object whether to do hitbox collision checks or not. (Not to be confused with a hitbox collision check however.) Add force: add_force(str axis, val force) takes an axis (the first input, can be x/y/z) and applies a force to it (the second input). Directional force: dir_force(val direction, val distance) takes a direction, and applies a force to the x and z axis, by the distance amount. On floor: on_floor() Checks if the object is touching a floor surface (Not necessarily the ground level floor) the returned value is stored in the variable “data_return”. Collided: collided() Checks if the object collided with a vertical wall. The returned value is stored in the variable “data_return”. Physics tick: physics_tick() Runs physics when used. This should be put in your loop, preferably after you’ve done all physics related things. Use physics blocks to add simple physics to your object. It can be used in many ways, and can be a suitable alternate to objects blocks, for making more advanced projectiles or movement, etc.
The model blocks: Set model: set_model(str model) changes the objects model to a model from your files. Static3D models may need you to refresh the models. Refresh models: refresh_models() Clears the model list and render queue, to show newly applied models. Set bone: set_bone(str bone) Sets the model to follow a bone. (May lag really badly if the models was given an incorrect bone.) Rotate bone: rotate_bone(val 0, val 0, val 0, str bone) Sets the bone rotation to the provided x(yaw), y(pitch), and z(roll). The speed is dictated by the ease(val value) block. Turn bone: turn_bone(val 0, val 0, val 0, str bone) changes the bone rotation by the provided x(yaw), y(pitch), and z(roll). Set ease: ease(val value) Sets the objects bone rotation easing to the value you provide. Set the value to 0 for linear easing. Set the value to 1 for instant. Set it to higher for smooth easing. Use model blocks to animate floors, change levels, animate based on values in code, and change the look of your player or level.
The game blocks: Note: to use game blocks, you also need to include physics. Include game: include_game() Tells the object to include all game related modules. Please make sure to use this if you want to add player control to your object. (Using the camera related blocks does not require including game, however.) Movement type: movement_type(str type) Sets the movement type for the player. As of now, the only 2 valid options are humanand vehicle. Movement: movement(val speed, val turn_speed) Movement ready function. Put this in a loop to get movement going. Key pressed: key_pressed(str key) Checks if the key provided is pressed, and returns a true or false. the returned value is stored in the variable “data_return”. Get key: get_key() Finds the currently pressed key, and returns it. the returned value is stored in the variable “data_return”. Set camera: set_camera(str camera) Sets the current active camera. Put the name of the camera you want to activate. First person cam: camera_1st(str object, val elevation) Makes the current object act as a first-person camera, by executing a ready-made camera function. Put the name of the object you want to follow, and the elevation value. Third person cam: camera_3rd(str object, val distance, val speed) Makes the current object act as a third-person camera, by executing a ready-made camera function. Put the name of the object you want to follow, the distance from it, and the easing value. Field of view: fov(str fov) Sets the field of view to the value you provide. This applies to all cameras, not just your object. Use game blocks to create player movement, detect key presses, create cinematic camera effects or edit the field of view.
The math blocks: Please note, that all math blocks return a value in data return. As so, this will not be mentioned individually in each block. Random A to B: random(val a, val b) Picks a random value from a to b and returns it. Put a decimal in your range to pick from decimals instead. Mathematical A & B operations: add(val a, val b) subtract(val a, val b) multiply(val a, val b) divide(val a, val b) modulo(val a, val b) power(val a, val b) Does a mathematical operation between A and B, and returns it. A operations: sqrt(val a) sin(val a) cos(val a) tan(val a) log(val a) asin(val a) acos(val a) atan(val a) floor(val a) abs(val a) Does a function operation based on A, and returns it. Interpolate A B C: interpolate(val a, val b, val c) Gives an interpolation value, where A is the new X, B is the old X, and C is the Easing value. You should add the returned value to X. Clamp: clamp(val a, val min, val max) Takes a value, and keeps it within the range of min and max. Set the value to the return. Letter A of B: letter(val a, str b) Gets the letter number A in the string B. join: join(str a, str b) Joins strings A and B into one string. Logical A & B operations: and(val a, val b) subtract(val a, val b) xor(val a, val b) not(val a) greater_than(val a, val b) less_than(val a, val b) equals(val a, val b) Does a logical operation between A and B, and returns it. Use math blocks for more advanced calculations and operations, it can be used to calculate special score mechanics, more advanced physics, or 3D space transformations that simpler blocks cant make.
The terminal blocks: Note: to open the terminal, hover over an (i) that shows up in the bottom left, when you run your game Clear: clear() Clears all terminal logs. Print string: print(str hello_world, val color) prints a string, with a color. The color must be a number from -200 to 200. Print variable: print(var variable, val color) prints a variables data, with a color. The color must be a number from -200 to 200. Print number: print(val value, val color) prints a number, with a color. The color must be a number from -200 to 200. The terminal colors are: Use terminal blocks to visualize variables, print debug points, keep track of events, and organize your code or sync it.
The variable blocks: Set variable: var variable = val value Sets a variable in the object to a value. Also used to create the variables, When the code runs this block for the first time, the variable will be created inside your object. Set to data return: var variable = data_return Sets the variable provided to data_return. Data_return is just the returned value from the last reporter block. Increase variable: var variable += val value Changes the variables value by a positive amount provided. Decrease variable: var variable -= val value Changes the variables value by a negative amount provided. Multiply variable: var variable *= val value Multiplies a variable by the amount provided. Use decimals to divide. Variables blocks can also control virtually everything. The objects position is stored as a variable called x, thus, setting or changing the variable “x” will change the objects x position. Another example is if you want to check an objects y position (for games like platformers). In the variable input in an if statement, just type yin there, and it will automatically check the objects y position. Just make sure to change the type input before the variable name to var. Also, lets say you want to get the yaw rotation of the object player, inside another object called projectile: get_data(str player, str rx). rxhere is the yaw rotation variable. Here is a list of internal variables: o x, y, z: the objects position variables. o rx, ry, rz: (in order: yaw, pitch, roll) the objects rotation variables. o sx, sy, sz: (in order: width, height, length) the objects scale variables. o data_return: yep, you can directly just type data_return to get the returned value from the last reporter block. o name: this will return the name of the object. you can also force change the name, which can lead to bugs and broken code. o model: you can also directly change the model from this variable. o script: this will return the current script. you might be able to change the script, but its untested and probably not the best idea. Instead, you should clone (new script) > delete current object. this is much safer. o clock: this will give the current line the object is executing. You can probably make machine-code style loops by setting the clock to 0 to get back to the first line. It will also return haltwhen the code is finished. o wait_clock: this is a countdown timer that stops code execution until it equals 0. While you wont be able to pause directly with it, you can still get its value and how much is left for the wait clock. o bone: this returns the objects current bone. You can also change it, but its not guaranteed to work. o velx, vely, velz: these are the velocity variables. They are only included when physics is included. You can control the velocity and read it from them. o gravity, jumpheight, friction, bounce: the physics’ factors internal blocks. These are not the only internal variables. If youre still curious, you can check the scene list.
The list blocks: Note: unlike variables, which are stored in the object itself, lists are stored in the files. This makes them slower to recall, but much more optimized to loading and storing larger amount of data. That also means they can still store their data once the project stops running, if they were created in a non-temporary file. Create list: create_list(str name, str file) creates a list inside the file provided. Clear list: clear(str name) clears the list that you choose. Type the name of the list inside the name input. Add item: add_item(str listname, str value) adds an item to the list you choose, with the value you provide. Edit item: edit_item(str list, val index, str newvalue) similar to the replace block in scratch. Edits an item with the index number, in the list you provide, with the new value. Delete item: delete_item(str list, val index) deletes an item with the index number, in the list you provide. Read item: read(str list, val index) reads an item with the index number, in the list you provide. the returned value is stored in the variable “data_return”. List reporter: read_list(str list) Returns the list in the data_returnvariables, with all items with a comma separator between them. List length: length(str list) returns the length of the list. the returned value is stored in the variable “data_return”. Use list blocks to store larger amounts of data at once, like the inventory of the player, or store data even after the project is stopped.
The interface blocks: Please note the interface blocks are only compatible with UI-element objects. All UI related modules are included automatically for UI-elements. Set costume to: set_id(str costume_id) sets the UI-elements costume to the provided ID. Write your costume name in here. Set it to empty to hide the UI-element (just make sure your costume name doesn’t contain spaces, capital letters, or special characters) Display text: text(str text) shows a text, centered on your UI-element. Type in your desired text. A text and a costume can show together at the same time, but the text displays over it. Go to: set_pos(val x, val y sets your elements position to the provided x and y. Set direction: dir(val direction) sets your elements rotation to the direction provided. Scale factor: scale(val scale) sets the elements scale factor the provided number. (Just note that the factor multiplies by 100. Large numbers lag.) Mouse pos: get_mouse_axis(str axis) type in either xor yto get the mouse position. the returned value is stored in the variable “data_return”. Set clickable: clickable(str true) sets the element to whether you can click it or not. This input expects a true or false value. Is clicked: clicked() checks if the element was clicked. the returned value is stored in the variable “data_return”. You need to have set clickable to “true” beforehand though. Ghost effect: set_ghost(val value) sets the UI-elements ghost (text and costume) to the provided value Use interface blocks to control UI elements, to add GUI, score counters, buttons, get the mouse position, and make custom splash screens.
The file blocks: File blocks are advanced territory. They have shown to be stable, but its still very possible to accidentally break or delete important files in your project if not used with caution. Create file: create_file(str name, str true) creates a file with the name you provide. The second input (true or false) determines if the file is temporary or not. Temporary files get deleted when you stop the project. Delete file: delete_file(str name) deletes a file with the name you provide. Move item: move_item(str name, str filename) moves an item into a file. Copy item: copy_item(str name, str filename, str copyname) copies an item into a file with a new copy name. Delete item: delete_item(str name) deletes an item (like a model, list, scripts, etc...) Create item: create_item(str type, str name, str file) creates an item. Supported items: lists, models, scripts, bones, and textures (Just note textures (in the files, not in the inspector) are legacy items. They are useless and will likely be removed later.) Use file blocks to organize really complex projects, automatically mass create data, store player data easily, and delete unused data quickly too.
The Time blocks: Time blocks are all reporter blocks (except for stop script and reset timer).their output is automatically stored in data return, and so, wont be individually mentioned for each block. Stop script: halt() stops the execution of the current script. will print a different stop message, unlike the usual finished code. Current time: timer() returns the timer value. Reset timer: reset() resets the timer back to 0. Ticks from start: ticks() returns the tick amount. Ticks increment by 1 each frame. Timer * factor: timer_factor(val factor) returns the timer value, multiplied by the factor. Very useful for sinand cosblocks. Tick * factor: tick_factor(val factor) returns the tick value, multiplied by the factor. Also, very useful for sinand cosblocks. Delta time: delta() returns the delta time. Use object blocks to control position, rotation, scale, and to read and edit other object’s variables. It is an essential part of a good project.
The editor blocks: (removed the raw function for space.) Editor blocks do not support tile (blocks) type models as of now. editor blocks let you create full models from scripts only, and create objects too. They are very useful for world generation. make sure that you have a 3d type object with your script assigned to actually generate things, though. Include editor: includes editor related modules. Required. Create model: creates a model, with a name and a type, in a file. Create bone: creates a bone (but you cant edit them anyways) 3d object: creates a 3D object, with a model and a script. Static3d object: creates a static3D object, with a model. Edit mode7 model: edits a floor models texture. (Needs a refresh) Set 3d points: sets the x(number), y(number), and z(number) for 3D models. Add quad to model: adds the quad with the data that youve set to a model. Set 2d points: sets the x(number) and z(number) for segment models. Set fake height: sets the ytop(number) and ybottom(number) for segment models. Add seg to model: adds the line segment with the data that youve set to a model. To create a mode7 model, first use the create model block, and set the name to something like floor01, and set the type to mode7. Next, use the edit mode7 block, enter your model’s name (floor01 here), and set the texture the texture number you want. Finally, get the static3d object block, and set the model to your model’s name (floor01 here), and set the name of the object itself to floorfor instance. From the model category get a refresh models block, and put it under your script. (You don’t have to necessarily name them floor01 and floor here, just make sure theyre named differently.) To create a segment (advanced map) model, first use the create model block, and set the name to something like map01, and set the type to segment. Next, grab 2 set 2d pointsblock, and place them under each other. Set the number in the top one to 1, and the bottom to 2. Set the x and z values for each. (Try -1, 1 for the top one, and 1,1 for the bottom.) Now grab 2 Set fake heightblocks, and place them under each other. Also set the top one to 1, and the bottom one to 2. The number will set the height for the corresponding point with the same number. (Try putting 1.5, -0.5 as the values for the ys in both.) Add a add seg to model blocks, enter your model’s name (map01 here), set the texture, and set the group to 0 for a single segment. However, if you want a shape like a box (youll have to repeat this 4 times), then name your group something unique like a1. For now, just set it to 0 and the surface to 0 Finally, get the static3d object block, and set the model to your model’s name (map01 here), and set the name of the object itself to mapfor instance. From the model category get a refresh models block, and put it under your script. (You don’t have to necessarily name them map01 and map here, just make sure theyre named differently.) To create a 3d (3d sprite) model, first use the create model block, and set the name to something like model01, and set the type to 3d. Next, grab 4 set 3d pointsblocks, and place them under each other. Set their number input to 1,2,3,4 in order. Type the x,y,z values of each point. (If you have a weird shape that looks like an X, then swap point 3 and 4.) Finally, get the 3d object block, and set the model to your model’s name (model01 here), and set the name of the object itself to test3dfor instance. Leave the script empty for now. From the model category get a refresh models block, and put it under your script. (You don’t have to necessarily name them model01 and test3d here, just make sure theyre named differently.)
The sound blocks: To use sounds, just import them into the sound editor, just make sure your costume name doesn’t contain spaces, capital letters, or special characters. Play sound: play(str sound_name) plays a sound. Simply type the name of the sound you want to play. Stereo sound: stereo() sets all sounds to play as stereo. (if the sound itself is) Mono sound: mono() sets all sounds to play as mono. Advanced play: play advanced(str id, str sound_name, val volume, val pitch) plays an advanced sound. Advanced sounds can have custom volumes and pitch values. These values can also be edited while the sound is still playing. Set the ID to something unique. Edit sound: edit(str id, val volume, val pitch) edits the volume and pitch values of the sound with the ID you enter. Useful for controlling background music. Use sound blocks to add more depth to your game, with sound effects, background music, or UI sounds.
The other blocks: Other blocks are now mostly control blocks. However, as the engine gets more updates and features, it will have more blocks that didnt fit into any previous category. Wait: wait (val value) waits for the number of seconds you input. (You can have decimals down to 0.01) If (equal, more, less): if (var variable =/>/< val value) checks condition, and if true, executes whats inside it. Forever loop: forever loops whats inside it until the program is stopped (or halted) While (equal, more, less) loop: while (var variable =/>/< val value) executes the code inside it while the condition is true. Once its done, the code just moves on to the next order. End while: endwhile marks end of the while loop. Forever loop: endif marks the end of an if statement. End while: endforever marks end of the forever loop. Use other blocks to control your code, add delays, loop certain (or all) the code, and execute if statements.
Simple ideas you can make: A camera track for a cool cutscene: by placing multiple objects in a track you want, then using the go to object block(with a speed like 20) for each object inside the camera, you can create very smooth camera tracks. Add extra fun by using the point towards objectblock, and adding that object somewhere for the camera to focus. Importing custom textures: custom textures are a part of the amazing experience of glue3D. while the basic textures are fun to get you on your feet, custom textures bring a lot of depth to your game. Adding 2 players into your game: while you cant make split screen games, you can definitely add 2 players on the same screen. You can make it competitive, or make them work as a team. The possibilities are endless! Mess around with physics and 3D: probably the most fun of all. Just add a lot of objects to your scene, and using the base physics library, create custom physics for them. Have fun with the model editor: the model editor features a doom-style map editor. Its very fun to push the boundaries of this editor, and create really great looking maps. You can also mess around with the tile editor, which is much easier and also very fun.