Add Object Actuator results in Strange Clicking Problem

I am using the Add Object Actuator to add a Drum to my scene. The drum responds to a click (Left Click + Mouseover sensors).

My scene has an empty that, when I press P adds a drum to the scene and then moves 1 bu to the right. That works fine. I can add multiple drums no problem.

However, the clicking is messed up. Here is how:

  • I start the game
  • I add a drum by pressing P. This responds to clicking on it fine.
  • I add a second drum by pressing P. It is added to the 1 bu right of the first (as expected). But now the first drum does not respond to clicking, and stranger still is that clicking on the second drum makes the first drum respond. But the oddness continues…read on.
  • I add a third drum. Now the first drum still does not respond to clicking but the second responds to exactly 1 click then stops responding. Clicking the third makes the first respond.
  • This continues onward.(Add 4th drum -> 3rd drum responds once and clicking 4th activates first)As I am writing this, I am testing the problem too, and there are many more peculiarities. I have attached a .blend (open it and start the game in the 3D View screen) where you can see these for yourself.

The blend file:

  • Try adding four drums immediately and then trying to click the second or third.
  • Try adding a second drum, testing it, and then add the third and immediately add the fourth. Now test the third and notice the second and third respond.Anyone know what is going on?


I’ve run into this problem and many others like it as well. Trust me, the strangeness can get much stranger than you’ve ever imagined once you start adding Python code to the equation. There is no solution that I know of, since the problem is in the way Blender handles added objects. I’ll try to explain why you are seeing this strange behavior, though.

Short answer:
You can’t use the MouseOver + Left Click combination with added objects.

Long answer:
You may know from modeling in Blender that there are two ways to duplicate an object. You can either make a “full copy” (Shift+D) or an “instance” (Alt+D). Full copies have all of their own data and do not share it with any other object. Instances share all data except transformations (position, rotation, and scale) with the original object from which they were created. For example, if you change the material on one instance, they all change.

You can make an instance into a separate copy by using the “Make Single User” menu (U Key). In the menu, you can select to what extent you wish to make the object unique. If you don’t make the object completely unique, then it will be something we might call a “partial copy” or a “partial instance”. It is not a unique individual copy, but it is not a true instance either.

Now, it seems to me that added objects in the Game Engine behave like these “partial instances”. They are not full, individual copies. In fact, if you look into it, you will find that all added objects actually share the object name of the original, so there is no real way to distinguish between them without assigning them a unique id at the time they are generated. Since that is the case, there are many strange things that happen when you try to use them as though they were full copies.

I’ve not read the source code, but I believe MouseOver uses a ray sensor from the mouse cursor position to find out what object it is hitting. When you use the MouseOver sensor in an object’s logic, it is most likely checking a global value somewhere to see “Is my object name listed in the MouseOver collision list?”. The reason the first object is the only one that responds is probably because it was the first object to place itself in the Object List with that name. The reason the last object is the only one responding may be because it is taking control of the collision identification when it is created.

Try Crystalspace, you can have mouseover+left mouse clicks with added objects.
Plus a lot more , with a lot less programming :smiley:

The bad thing about this problem is that it didn’t exist in earlier Blender versions. But now, for whatever reason, the first object gets all priority.

A related glitch: play an IPO on an added object and, no matter what the IPO is, all added objects will react as if they got hit with a Loc IPO.

Thanks all. I am soo looking forward to the next Blender release. I understand a lot of the strange glitches in the game engine will be fixed.

I’ll take a look at CrystalSpace, but I really like the level of abstraction I get from Blender.

Hey guys, Blender 2.45 is already out. Add object problems are fixed :yes:

yea it works fine in 2.45!!

Woot! News this good and its not even my birthday.

I’m so happy I want to dance a jig. :smiley:

Now I wonder if the deeper problems in Python scripting with added objects have also been fixed…