collision problem with add-object actuator

if I add an object using the “add object” actuator, how do I get other objects in the scene to collide with it? the reason I need to know is because I’m trying to make a dynamically generated game. So far I’ve got the python part to add the objects working, but my character falls through. At first I was using add mesh, but the character seems to collide only with the original mesh, not the new one.

Not exactly sure what you are asking. But for collision with the logic blocks you need to test for a property of the object to register the collision. You can also collide with a material, but from what ive read, that doesnt work as well as just a property of the object.

Also, I have tried both replace mesh and add new. I like the add new better because it gives more control over the new object from its logic bricks.

Perhaps you can translate that to python?

I have no problem adding the objects, but once I add them, my character won’t collide with them

eg.

which needless to say is really annoying.

anyone know how to workaround this?

Attachments


Posting your blend here helps a lot. Well I try to guess anyway… those added objects don’t have collision faces enabled (face mode, check collision)? They have ghost mode enabled?

collision is enabled and nothing is ghosted.

here’s a blend

http://nagolinc.googlepages.com/movingworld.blend

I think the problem has something to do with adding more than one instance of an object.

Oh, and the reason that the character doesn’t fall through the floor is because I have an invisible object on the main layer underneath him at all time.

Looks like you just ran to the same bug I encountered when I was making a city building game a while ago. I had to ditch the project because of that bug. Here’s my bug report: http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=997

Basically an added object loses its collision mesh after a new instance is created. Only the newest instance can be collided with. Dynamic objects don’t suffer from this, only static. The bug was introduced in Blender 2.43 after Bullet physics upgrade.

You can use Blender 2.42a if you don’t need the new features of 2.43. There’s also a nasty message actuator bug in 2.42a.

Okay, so the problem is with Bullet physics and can be solved by switching back to Sumo. I suppose I don’t need anything fancy anyways since I’m just making a fps for now.

Hope this bug gets fixed soon anyways and thanks everyone for the help.

lol your probally like the 100th person to run into this bug… ;-(

I’m doing the same thing and I also ran into this problem. The bug still exist in version 2.44…
Recreated it like PSK131 and the Social’s bullet physics compatible camera (tested in 2.43 & 2.44) (Boxes are placed automaticly):
http://www.megaupload.com/?d=5VMM900B

But when I press a button to add objects one by one, it does work :S (tested in 2.43)
http://www.megaupload.com/?d=J7ZNIPLP

Press “Z” to place a box

Edit: It’s weird, sometimes I can’t walk through all 3 boxes and sometimes I walk through some boxes :S

The previous does not work in 2.44
Test 1: Placed 3 boxes, could move through box 2, but not box 1 and 3
Test 2: Placed 3 boxes, could move through box 1 and 2, but not box 3
Test 3: Placed 5 boxes, could move through box 1 and 2 but not hte others

Edit:
Someting intressting happend while I tested it in 2.43 with the version where I had to manually place the objects:
Test: placed box 1, moved right, placed box 2, moved right, placed box 3
Result: After placing box 3 I could move through Box 1 and 2, but not 3

Test: Placed box 1 and walked against it, Placed box 2 and walked against it, Placed box 3 and walked against it
Result: After walking against the third box I walked to the first 2 boxes again and could not move through both.

Does anybody know a workaround for this for 2.43?

the only workarounds I’ve figured out are to use sumo physics instead of bullet or to make multiple copies of the object you want to add and use a python script or something to make sure that you don’t add the same one twice. If you add two of the same object, bullet physics will detect only one of the two for some reason.

Try the test again but have an empty ghost bonk into each object when they are created. Then perhaps bullet will continue to see them for the rest of the situation? Maybe.

I had the same idea. I tried to make something like that. When I automaticly added a box, I first let a cube fall on it (an Dynamic object, just like the camera). After that I placed the box somewhere else and added the next box. Again the cube falls on it and it is placed somewhere else. This way I created 5 boxes, but could move through 4 of them, and at the 5th the game slowed down. Here is the .blend:
http://www.megaupload.com/?d=Z9JX6M15

This must be an Bullet - Blender integration bug. I’m very busy right now, and focussing on Bullet Multithreaded.

Blender development has switched to Subversion, and I haven’t catched up with that yet. I hope to get some time to look into this, it should be a small issue to fix.

Thanks,
Erwin

Ever since this bug came up, I always seemed to run into it when I wanted to make a game. I find it nearly impossible to create even a simple game with this bug.

While I’m complaining… I’m sure it’s a recognized problem, but sound doesn’t work either (OS X).

I agree. Adding (static) objects in realtime was a workaround to BGE object count limit in addition to other uses. Sorry to say this, but I think this is the worst bug I have seen in BGE.

Just fixed this bug in Blender Subversion.

If you compile your own version of Blender, just fix two lines:
from m_cci.m_MotionState to m_MotionState in Blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp around line 108
so it will look like:

void CcdPhysicsController::CreateRigidbody()
{
btTransform trans = GetTransformFromMotionState(m_MotionState);
m_bulletMotionState = new BlenderBulletMotionState(m_MotionState);

Check precompiled Blender binary win32 version here, includes latest Bullet 2.53 version:
http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=blender_post2.44_win32_release.zip

Enjoy,
Erwin

erwin:

Im sure everyone thanks you. Wow, only two lines of code, but hard to snag.

Great! Thanks Erwin! Finally I can continue using BGE.

This bugfix and upgrading to latest Bullet 2.53 introduced a few new glitches (vehicle wheels rotate opposite, kinematic/animated objects have issues, scaled objects etc).

I hope to fix those before next release (around Siggraph?),
Erwin

thank you so much!
Now I can finally continue work on my blender-game-engine clone of Spore!