getting positions of other objects with scripts?

Hi… I’ve got two spheres… a big one with a smaller one inside… I want the big sphere ( a dynamic rigid body)to roll around, no problems there can control it perfectly, but I want the smaller sphere to get and use the big ones position and orientation as it rolls about.

I’ve tried scripting but with no luck… tried getting the list of objects in the scene and setting the postion (using other posts as reference) but nothing seems to work (yes I checked names and hooked up the scripts correctly etc etc)… I did manage to get debug properties showing that will show me on screen what the postion and orientation of both spheres are as they move. So I can check if they are getting the correct info.

So how would I write script like this? Do both spheres have to be dynamic? Can one be a ghost? I tried turning off collisons for the faces but that had no effect. Can one sphere be dynamic rigid body and other static? Do I have to have a motion actuator in order to get and set the position of the smaller sphere or any object fo that matter?

I can post a blend file if needed. Thanks for any help in advance.

You should be able to set the position and orientation of any object with
object.setPosition(), object.setOrientation(). It’s usually best to break your problem down into small pieces and test them one at a time. Setting orientation can be a bit tricky in python because there is global and local orientation. But from what I understand you shouldn’t have to worry about local orientation unless there is parenting. If there is parenting you have to multiply by the inverse of the parent.

You could just parent the smaller sphere to the larger.
All you would have to do though is set the smaller sphere to no-collision on each face. You can access that under the UV Face select mode and under editing (F9).

That is all if the smaller sphere does not collide with anything.

I turned on no collisions and it had no effect (worked in older versions of blender)… as in it still collided… and parenting doesn’t seem to work when you parent to a dynamic rigid body flies all over the place… does anyone have an example blend file where your are getting the position of another object for me to look at pls. I’m clearly doing something wrong in my script.

It might be better if you post a very simple example of what you are trying to do. There isn’t much you can do wrong with getPosition():

scene = GameLogic.getCurrentScene()
obj = scene.getObjectList()["OBname"]
pos = obj.getPosition()


Last time I checked one can parent a “NON-DYNAMIC” object with no collisions to a dynamic rigid-body.

In any case, if you need a get/set position blend, then check out my character template link. The link is in my footer. Follow the “Set/Get Position” link.