I’m currently searching for a solution (logic bricks or python) so i can ‘remove’ an object from the GE and later 'add ’ it again.
By ‘remove’ i mean that it should not produce any collision-information via the “Collision” brick and vice versa for ‘add’.
I already tried the “Edit Object” -> “End Object” brick with works as expected, but the “Add Object” (EDIT: I use the object name of the original object) isn’t really doing anything :-/
Any ideas?
Werner
PS: In the end I want to create a slope/pipe that is rotated (via ipos -> left-right) each time a sphere is passing trough. I have other problems here as well, but the ‘removing’ and ‘adding’ of objects is puzzling me.
On the other hand a hint how i can set properties after an IPO animation has finished would help me even more (this would probably help me avoiding the problem above at all).
Add object actuator adds only objects that aren’t in the active layer. You could use replace mesh actuator to replace the mesh with mesh that has all its faces disabled for collision. Then bring the old mesh back when you need it again. You could also use timer properties to determine when IPO animation has finished, but it doesn’t work if your animations loop.
Set actuator type to property. Enter an existing property name (should be int) e.g. frame. Activate the actuator with an always sensor (no pulses) connected to an AND or OR controller connected to the above IPO/Action controller.
Add logic to count and watch the property.
For the your logic add 1 to the property for each frame. Have a sensor detecting when the property reaches the last frame.
Add Object:
The object to be added must be on an hidden layer.
@PSK131 Thanks, the tip with the mesh-replacement. I just added an object with an empty mesh, this works fine … Dunno how to turn of collision for an object though … even in ghost mode (which i use already for my triggers) collision is preserved.
@Monster: The idea with the counter seems to be the best (i.e. the easiest possible) solution, i’ll try this soon.
Collisions can completely disabled by going face mode (F), selecting all faces (A), then edit buttons (F9), turning off the ‘Collision’ button in the ‘Texture face’ panel on the right and finally pressing the ‘Copy drawmode’ button.
Many thanks for all your help (@PSK131: I didn’t knew that these things are possible in face-mode - I always look in edit-mode … way cool :)) even if I didn’t need everything mentioned in the end…
To show you how my attempt turned out … here’s my small test-file with an object named “shooter” … just focus on it and run the game to see the basic functionality (I think Blender 2.43 is needed, but it might work in 2.42 as well).
There are more (passive) elements such as slopes, spirals and similar for directing a ball in there that might be of interest for some people.