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.
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 =/
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.
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