I made a projectile with physics, and i added logic to the weapon,
when key “space” is pressed the action is “Edit object : add” the projectile object to the scene.
It seems nothing is never added after many attemps.
For add object to work you have to hide the original object and not have it parented to another object.
It does not work with invisible on Upbge 0.3
This seems to work:
Move objects you want to be added to the scene into a new collection and call it something you remember
Keep the collection active, otherwise it wont work, but once all your objects are in the collection, right-click on it and do
Visibility -> Hide All Inside
That will disable all the objects at startup and enable you to add any amount of them you want to the scene Adding does not work with parented objects or compounds as far as I know, as @KazRuiz said
You’re only half way in setting up add object in the file you provided. The target object was a sphere but it wasn’t hidden and to do that you have to uncheck both the eye and camera icons. To show the camera icon you have to enable it in the filters.
tip: You don’t need an Always sensor for this to work with a Keyboard sensor
If you want an object to be added every set amount of time while pressing Spacebar you can do something like the image below. The up arrow is checked and Skip is set to 30, which means that every 30 frames that object is added.
If you want the object to add on its own you could do the same but only using an Always sensor. By not checking the up arrow the Always sensor will only work once when the game starts.
Keyboard & Always Add.blend1 (655.8 KB)
Thanks, it works.
I can see some small frame drop each time an object tis added, i guess the best way is to use pooling when your game use a lot of projectiles on a scene.
i have same problem. Same settings use in bl 2.79 …is functionally. UPBGE not working correctly
It doesn’t require “Disable in Renders” to work. However, it forces objects to render even if they are render disabled.
What is the best way to disable render in this case?
Thank you so much for this solution! I never learned to use Blenders layers and the UPBGE search function seems broken too causing UPBGE to crash any time I typed in as much as “Lay”. Thank you so much for your comment and images!!!