34

Warning: this is a long answer. It may take a while for some of the images to load. For those of you who don't like reading: The working .blend files are at the bottom of this answer. Basic Mechanics You first need an empty (named Arrow) to follow the mouse. This empty will add the buildings. You will need a script like this. from bge import logic def main()...


20

This problem is caused by the moment and rotation restraints on the top gear. To fix this, I recommend removing them: Now, if you run the simulation, The top gear is responding to the collision with the bottom gear. This is progress. (smile! - it almost works) We just need to get the gear to ignore translation, but still respond to rotation. This can be ...


16

What a great question! It was actually surprisingly simple to make. The texture: I started by modeling a few snowflakes, and then used them as the display objects for a particle system. I then rendered out one frame with the screen covered nicely in snow: Using the texture: I then took that texture, and put it on a large transparent plane. The texture ...


13

If you want to access a property from the current object controller it's : cont = bge.logic.getCurrentController() own = cont.owner my_property=own['propName'] But if you want to access to a property from an other object it's scene = bge.logic.getCurrentScene() my_property=scene.objects['other object']['otherpropName']


13

This happens because the camera is parented to the missile. When the missile disappears, so does the camera. When the camera disappears, there is no longer anything sending the output to the display. This creates the problem, because blender can't update the display, and Blender crashes. You can fix this by having a scene actuator to set the camera to a ...


13

Starting with the rig that is in this answer, Making a grid snapping system is actually very simple. First, select the ground plane and scale it to be relatively small. Replace the script on the ground plane to this from bge import logic def main(): scene = logic.getCurrentScene() cont = logic.getCurrentController() own = cont.owner ...


10

We need to start with a object that tracks to the mouse. Before we can do that, we need something for the object to track along. for this we will use a highly modified cylinder that resembles an inverted cone. We need a shape like this so that the player can not ever move the mouse outside of the tracking zone. Now the higher your mouse is, the further ...


10

Rain/Snow effect A massive amount rain drops/stripes and snow can be achieved by showing one or more planes with according partly transparent textures in front of the camera. Multiple planes can result in a depth effect. It adds some variation to the "falling" too. With a certain number of objects it will be harder to notice how many paths they take. The ...


9

This is done using the bpy.types.Sensor.link method, e.g. import bpy obj = bpy.context.object sensors = obj.game.sensors controllers = obj.game.controllers actuators = obj.game.actuators bpy.ops.logic.sensor_add(type="ALWAYS", object=obj.name) bpy.ops.logic.controller_add(type="LOGIC_AND", object=obj.name) bpy.ops.logic.actuator_add(type="ACTION", object=...


9

First you have to enable Object Color, that is found in the Properties window, Material tab, then under the Options region Object Color. One quirk I found, be sure that the diffuse color of the material is pure white [1, 1, 1]. If it is not you will only be able to control the color up to that level. Example: say the material's color is red [1, 0, 0], now ...


8

In one of the files you sent, RigRichardMaleGame.blend, you did several things wrong, the two most significant being that you moved the metarig away from the generated rig instead of just hiding it. See #4 here. That next thing you did wrong was remove the Armature modifier from the base mesh, this is what links the mesh to the rig. Your animations will ...


8

This is not possible to do using the explode modifier through the particle system. However, you can use a rigid body simulation to simulate the debris, and animate each piece. Those animations can then by played in the game engine.


8

The Mouse Sensor when set to Left Button will send a positive pulse whenever the left mouse button is clicked. To get it to trigger only when over a specific object you have to add another Mouse sensor set to Mouse Over and plug it in to the same And controller as the click sensor. Like in the image below.


8

You can do this by having your gun fire a setup like this. Before, you gun just fired the cone, and there was nothing to make it rotate. however, if the cone is parented to a cube with the physics set to Rigid Body, and the gun fires the cube, the cone will move with it. however, there is still nothing to make it rotate. This can be fixed by enabling the ...


8

You can use python to activate the Action actuator with this script. You will need three logic bricks: A sensor (to trigger it all), the python controller, and the action actuator. cont = bge.logic.getCurrentController() act = cont.actuators["Action"] # the name of the Action actuator if cont.sensors["Keyboard"].positive: # trigger when buton pressed ...


7

This is very easy to do. All you need is a Boolean property to be toggled, and when that property is true, the visibility will be true, and when that property is false the visibility will be false. In this case we are using NameOfProp as the name for the Boolean property, but of course it could be anything. A working example can be found here.


7

Problem The problem was that, your integer property Timer was still equal to 45 when the weapon was switched, for exactly one logic tick, allowing a shot to escape. Then, one tick later, the message actuator could deliver the message to assign the property Timer to 0. Reason The message system actually takes one logic tick from the time the actuator receives ...


7

Your character needs some way to count how many walls he has successfully passed. You can do this by making the character count when he passes above or below a wall - because the game ends when he goes through a wall. Before we can fix the problem, we need a simple game. Setup I'll start by adding sun lamps, and a ground.           Ground Plane              ...


6

You could use the delay sensor with the repeat setting checked:


6

I had to click the small button (highlighted) and set the frequency to 1. The option is called bpy.types.Sensor.use_pulse_true_level


6

You can use a bit of Python to get started, without knowing your exact implementation of the weapon system, i can't give you the full code. # get vector from centre of screen cam = logic.getCurrentScene().active_camera # vector in world space vect = cam.getScreenVect(0.5, 0.5) # get length of vect length = -cam.position[2]/vect[2] p = vect * length # ...


6

Logic bricks are best explained with an image : the basic idea is that instead of adding 1 to your “timer” you add an “increment” property. You then switch this "increment" to -1 when it reaches 4 and back to 1 (effectively +1) again when the “timer” value is back to 0 to switch the "increment" property from +1 to -1 I do some fancy math (inverting the ...


6

The reason for this is that there is a big difference between frames and logic ticks. There is a default of 60 logic ticks per second, and 20 frames per second. The current frame rate in your scene can be found here in case you accidentally changed it, but the default is 20. If you add a delay sensor, and hover over the delay field, the tool tip that ...


6

Solution All you literally need to do to fix this is Click this button. (on all of your Motion Actuators) Reason When the Ad button is not clicked, each Actuator is setting the location, and is is overriding any other Actuators activated previously, regardless of whether or not they are still running. Enabling the Ad button makes each Actuator add to the ...


6

Often times to control parts of the game that are kinda background or sidework, we add empties. Invisible empties can be used for playing sounds, loading levels, spawning bad-guys, or running pythn scripts. Create an empty that will run your script if it doesn't need to be on a specific object (a jeep for example ;) add an always sensor to it, and then ...


6

I was able to do that with Texture/Mapping/Coordinates set to global.


6

Set up the logic bricks as pictured above. This script will move an object (the cone) to the location of ray.hitPosition and then rotate it to point along the ray.hitNormal using alignAxisToVect(). For this example, the cone is pointing along the positive z axis. If it was along a different axis, I would have to pass in the second parameter to ...


5

import bge cont = bge.logic.getCurrentController() scene = bge.logic.getCurrentScene() target = scene.objects['target'] ray = cont.sensors['Ray'] if ray.hitObject and 'bullet' not in ray.hitObject: target.worldPosition = ray.hitPosition This script will move a empty (named target) to wherever the Ray sensors hits a another object. The gun has a Track ...


5

If I remember correctly, collision sensors fire twice by design. Once when set True, and another when False. This isn't a problem when connected to an And or Not controller (because they check) but in a script you'll have to do something like this: def collision(cont): # Loops through all connected sensors and returns if one is False # Basically ...


5

To expand on Jerryno's answer, a Rigid Body Joint is a perfect way to do this. To start with, make both your truck and trailer to the Rigid Body physics type, and position the trailer behind the truck where it would naturally sit while towing it. On your trailer, add a Rigid Body constraint, with the Pivit Type set to "Generic 6 DoF" You can enable "...


Only top voted, non community-wiki answers of a minimum length are eligible