Random Position at Startup

Hi Group,
Wondering if someone can help me w/ a Realtime question.

I have an actor, Cube1, who I want to put in a random position in a scene at startup.

Seems like one could do this in about 3 lines of Python, but I have yet to do it successfully.

Can someone help?

Using Blender 2.25


First, it seems, you are in the wrong forum. But I try to answer anyway.

Define for object property init, set it to 0, add property sensor to check if init is equal to 0 and connect it to Python controller, which will contain script:

obj = GameLogic.getCurrentController().getOwner()
if obj.init == 0:
  obj.init = 1

where rndFnc…() are functions to generate random coordinates for this object.

I really appreciate you taking the time to respond. Since there isn’t a Realtime forum, I posted here in Q&A.

Do you think you might could send me a simple *.blend file, as I still cannot get this to work.

The setPosition() call doesn’t affect my object at all. It always initializes in the same place.

[email protected]


Actually - there is a realtime forum.



sorry…I’ll head over there…with my tail squarely between my legs.