Add Object + Collision detection not triggering

I have a issue, which is complex. Maybe to complex for the physics in bge.

layer 1 : collision object

layer 2: obj1 with obj2 parented, now I want to make collision detection for the child. so got that setup.

back to layer 1: hide layer2, and have an empty spawn parent object from layer2, now the child turns up since it said so in docs also.

but now the tricky part, layer2s parent can detect collisions on the layer1 it’s spawned, but the child obj can’t. :confused:

anyone know a workaround? Should I attach blend, or is it so, that children to a added object is always outside the physics world to detect collisions?

Child objects don’t have collision detection of their own. They get it all in exact form from the parent.
One thing you could do is attach a logic string to the child object to remove the parent once it spawns ([Always with ‘tap’ ticked] — [And] — [Parent > Remove Parent]), unless you need the child to stay parented to the parent… otherwise, help is beyond my personal ability, sorry =/

what about 6dof joint locking the child to the parent?

is the item dynamic?

side note,

an item added to the world each frame in the place of the child would detect a collision,

As your layer 2 is hidden all objects in there are inactive. (Structural there are no layers just active and inactive objects)

The added objects are active and a copy of the inactive objects.

Be aware the static objects do not detect collisions. Because of the parent relation ship the child will not be dynamic.
You can make it sensor to detect other objects.
Alternative you can set up a compound relation ship. But I never did something serious with that. So I can’t really help with that.
Alternative you can establish a rigid body constraint relation ship. But I’m not sure if predefined constraints work with added object.

Yeah the added object is a rigid body and it’s collision detection works. But I think Im gonna give it a try with a script.

my idea is to add a collision cage also, (it will get collision) then after it’s added parent it to the first added object. that might work.

  1. add object + its children (just visuals)
  2. add 2nd object
  3. parent 2nd object to 1st object once they’re added to visible layer, and hope collision detection remains.

Accidental double post

you don’t have to use parent,
a sensor object even,

import bge
cont=bge.logic.getCurrentController
if 'target' not in own:
    scene=bge.logic.getCurrentScene()
    own['target']=scene.object['TargetObject']
else:
    target=own['target']
    offset=[0,0,0]
    own.worldPosition=target.worldPosition+offset
    own.worldOrientation=target.worldOrientation

BluePrintRandom good solution

Any idea about get offset different to manually for each object? Maybe with collision bound?


Also my object’s center isn’t on center really because I had to adjust a respawn problem, it could be a problem.