Set model position

I have a problem setting my models

self.teleportPos1 = pyramid.find('**/tPos1')
  teleport.setPos(pyramid.getPos(pyramid.find('**/tPos1')))

I created an emty node in Blender, but the model dosn’t position at the right place.

Hmm… I’m not quite sure of what you intend to have happen there. Specifically, while I take it that you intend the object “teleport” to be moved to a new position, I’m not sure of where that new position is. Do you mean to move it to a point within the object “pyramid”?

As it stands, and if I’m reading your code correctly, you seem to be finding the position of “pyramid” relative to a point within it, which I’m not sure is your intention. Since you seem to find what I presume is your empty node in the line above the “setPos”, why not set “teleport”'s position to the position of that empty node, like so:

teleport.setPos(self.teleportPos1.getPos())

(To check, is “tPos1” being found correctly? Have you printed it out to check that it appears to be valid?)

self.teleportPos1 = pyramid.find(’/tPos1’)
teleport.setPos(pyramid.getPos(pyramid.find(’
/tPos1’)))

Where do you want to place the teleport?
If teleport was reparented to render, and pyramid was changed pos, I think you should use:

teleport.setPos(self.teleportPos1.getPos(render))

Or I think, in any case:

teleport.setPos(render,self.teleportPos1.getPos(render))

My bad…nevermind the first line.I checked it this way
“print teleport.getPos(self.teleportPos1)” and the output is "LPoint3f(0, 0 , 0).It seems that it dont get the coordinates or smth, because the model appears on the 0,0,0 of render as default.Tried youre code but it didnt helped.

If I’m not much mistaken, “teleport.getPos(self.teleportPos1)” gets the position of teleport relative to self.teleportPos1, and therefore your output indicates that teleport is at the same position as self.teleportPos1, as presumably intended.

However, I think that lsyer has it correct, having noticed something that I missed: when you get the position of teleportPos1, you get it relative to its parent; if it is at its parent’s origin, then you should get (0, 0, 0).

Instead, you should presumably get the position of teleportPos1 relative to render, and use that position.

You say that you tried someone’s code; was it mine, lsyer’s or both?

both.I checked the egg file and the empty nodes are at the right coordinates that I set them.

Odd. In that case, could you perhaps print out and copy to this thread your objects and their positions in your scene graph, as well as the result of “pyramid.find(’**/tPos1’)”? Perhaps there’s something that we’re missing here. :confused:

I figured it out, the problem was in this
pyramid.flattenLight(), though I cant stil set the models by setPos(), I just reparent them to get the position.