Shaftoe
(Shaftoe)
June 18, 2003, 10:43am
1
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
Thanks!!!
ashsid
(ashsid)
June 19, 2003, 6:29am
2
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
obj.setPosition([rndFncX(),rndFncY(),rndFncZ()])
where rndFnc…() are functions to generate random coordinates for this object.
Shaftoe
(Shaftoe)
June 19, 2003, 7:23am
3
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]
Thanks!
phlip
(phlip)
June 19, 2003, 8:41am
4
Shaftoe
(Shaftoe)
June 19, 2003, 9:19am
5
DOH!!
sorry…I’ll head over there…with my tail squarely between my legs.