Collision Masks/Groups not work at start?

hello all…

i see that I have two objects, both with physics bounds on them. One is on physics layer 2, with masks set to layer 2 also. The other is physics layer 1, with masks for layer 1 also. I notice, when game start if they are ontop each other, they do not ignore each other as one would think…

Then I run game again, this time object not on each other, and I move obj 1 onto obj 2 with keyboard sensor and get result that is expected.

is there work around to start two objects ontop each other like i said originally without physics interacting?

does it work this way because physics are executed almost last in frame ticking (I think, if i read monsters guide correctly)

I would use addObject… but I want obj 1 to be parented to obj 2 at game start. Please advicing on this?

This is a known bug at the present time, for the first simulation frame.

dang.

is there any known way to work around it? or will i just have to ether move my parent mesh back behind the other mesh and just play it with a little offset, or maybe try and add object on an empty…

it is you say a known glitch for the first simulation frame, does that just mean the first frame of run-time… or first frame it interacts with the game? so what i am meaning is, if I addObject onto the second object, will i still find myself in problems with this bug?

A diagram to solve your issue.

I am sure there are other work arounds, but this worked for what I needed it for in a similar situation to yours.


Just make sure the two collision bounds are not intersecting when the game starts. Simply put the parent above the other for when the game starts. If it is dynamic physics, BGE gravity will make it fall into place as needed. If you need clarification (or anybody for that matter) lemme know.

It happens because the objects aren’t readable for the physics collision groups until after the first frame

Thank you Damutantman and agoose! You have helped me a lot!

But wait please! i haveing one more question now! Is there way to use collision groups with a ray? I have a lazer shooting at child object, but parent object covers part of it, and even though collisions bounds are set to different layers, the ray is hittiing it anyways.

is best option to use a special property for physics object I want to go through, then turn xray on, and set it to invert? I created ray without sensor, just rayCast built in function. is it even possible to do this without sensor?

Input is great thanks!

You can edit the rayCast settings using more of the properties in the function. Property value and Xray are what you want. Just insert Property name, and turn Xray to 1. You can probably leave distance and normals to 0, which is the default.