I know how to use the Add Object actuator to add an object while the game is running, but the angular velocity is not affecting the mesh. Is there something else I should have done as well? Workarounds that access the mesh and assign a velocity after creation are fine as well, but no python would be preferred.

I am using Blender 2.72, the objects are added correctly when I press the button, and the added objects also respond to physics when colliding with each other. Just the initial velocity is not working.

Here is my current Logic setup: logic bricks

up vote 5 down vote accepted

Your problem here could have a few very simple solutions. First, your projectile must be either a dynamic object, or a rigid body object. Static objects can not have angular or linear velocity.

Another solution could be that your projectile is getting lodged in the collision bounds of what is probably (in your case) a static character. The best way to make a gun turret is to have a static base that controls the rotation, a no collision barrel parented to the base, and an empty on the end parented to the barrel. Of course, you could just have your no collision barrel Emmit the projectile.

enter image description here

Logic setup of base

enter image description here

Logic setup of Barrel. Note- half of the logic here is simply to limit the rotation so you can not rotate the Barrel into the base. (collapsed view)

enter image description here

Expanded view of the logic for Barrel

enter image description here

Logic setup for the Empty, Note- the property sensor and the property actuator are to limit the ammo, and do not really matter for this answer. Nevertheless, it is way more realistic and funner to have limited ammo, so Your ammo is limited.

enter image description here

Physics options for the projectile. Notice that the X and Z location is locked. that means that the only way the bullet can move (only effects angular and linear velocity) is along the local Y. locking those two axes can be useful if you want to shoot lasers that do not drop due to gravity.If you want to have a hits based projectile instead of a physics based projectile, you can check the box enabling Ghost option, (below the actor check box) this will still register the collision, but it will not make the target physically react on collision. you could also then add a armor property to your target, and have each collision remove one of the armor points, then when the target's armor property reached 0 it could disappear. Locking the rotation along the X,Y and Z will only make the projectiles look more realistic if it is physically colliding with the targets.

enter image description here

If you had trouble following that, or simply want to examine the blend to see first hand how Everything works, you can always http://x.27 download the Blend file

You can simply add this logic on to your object that will be added via the Edit Object actuator.

logic bricks
All you need is a Always sensor triggering a Motion actuator. Set the motion to be local, with the L button.

  • I noticed that with this setup, collisions between the moving object and a stationary one look weird as the moving one hits, bounces, stops then starts moving again. – Scalia Jan 1 '15 at 22:33

After some trial-and-error, I have found a solution. Apparently the physics sim 'freezes' the spawned object inside of the spawning object, making it incapable of moving. What you need to do is use an empty. The same logic setup can be used as in the question.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.