UPBGE / upbge

UPBGE, the best integrated game engine in Blender
https://upbge.org
Other
1.43k stars 180 forks source link

addObject on OverlayCollection spawns on other Collection #1793

Closed sevi78 closed 1 year ago

sevi78 commented 1 year ago

hi, i try to spawn objects on a OverlayCollection and experienced some weird behaviour. if an Object is spawned on an OverlayCollection, the Objects added on this collection are then spawned in the main Collection of the active Camera...

They are spawned right when the Camera on the Overlay is set as active Camera. But then they are invisible in the OverlayCollection---

i tried out actuators aswell, instantAddObject, addObject-Method. Theree might be a proper workaround to do, or nobody has ever spawned objects into OverlayCollections(?). Or is it a bug? ...

https://github.com/sevi78/UPBGE-Tests

Btw: sidequestion: i dont know if i am this here is the right spot to discuss or post questions/Problems. I definitely dont want to waste your time, i highly appreciate your work here ! So should i continue post my experiences here, or someone recommend me another forum/repository to do so? Thanks in advance

youle31 commented 1 year ago

addObject/removeObject can't be used with overlay collections. To add something in overlay, you need a camera and a collection like in the following example:

multi_overlay_test.zip

Press numpad1 then numpad2

(internally, everything is added where the active camera is because old bge ignores collections and we choosed to add all objects replicas where is the active camera during runtime)

youle31 commented 1 year ago

So, to add/remove something in overlay, it needs to use AddOverlayCollection/removeOverlayCollection (even if the collection has only one object). Overlay collections is not meant to be used with addObject/removeObject. I close this issue to clean the tracker as I think I answered.