When an object is spawned (at a random location), is there any way of checking whether its position is overlapping another object? I’ve tried RayCast with a short ray length (to keep it within the cell) but it never detects a hit. Proximity and Collision also don’t seem to work on object creation.
If the object is set to “Movable” in the physics properties then it should detect collisions upon being spawned.
Thank you, making the object moveable did it! The documentation suggests it’s only necessary for an object to be solid in order for collisions to be detected…
Yes, collisions work normally even if the object is just solid, but for some reason, it’s only detecting right when it’s spawned that requires it to be movable for some reason
I’ve realised this may be an problem, as now the objects spawned are moveable, but I need them to be in a fixed location. I can’t find how to disable an object’s “moveable” property, just how to disable all physics for an object. Disabling all physics is also not desirable!!
Try connecting a Once to an Extractor to get an object’s X coordinate, send that to the Set output of a Number block, and then have an Always below the Once that goes to the Get of the Number block and connect the Out of the Number block to the X input of a Position block. Then do the same with another Extractor and Number but for the y coordinate.
On a side note you could avoid all of this by just setting the object to not be solid but still enable collisions (and keep the movable property).
Or if you had a link to the game it would be a lot easier to tell what specifically would work in your situation.
By the way, welcome to flowlab!
Thanks for the suggestions and the welcome! I’m trying to help my son out with a school project. I’m familiar with a number of programming languages but new to flowlab and trying to get my head around some of its apparent limitations. Link to test game here Flowlab Game Creator - New Game. It’s the gravestones that are randomly placed but should be fixed. The collision detect is so they don’t end up on top of anything else.
Makes sense; I think in the case of that game it would be a lot easier just to connect a Once to the Check input of a Proximity (set to detect the blue blocks within a 4 pixel distance), then connect the X output on the proximity to a Destroyer block.