How to put a model in a predefined point ?

I’ve created a small piece of environment in MAYA, and I also made a point to mark the place where I want my car to be loaded in Panda3D. In my code I read the position of that point from .egg file, and assign my car model at the right place. = loader.loadModel("Models/Environ.egg")
    self.startPoint ="**/StartPonit")
    self.SPforCar = self.startPoint.getPos()

    # Load the car and its collision sphere = loader.loadModel("Models/Car") )

But when I run the application, the car is not at the place I defined. I think there maybe some difference between MAYA’s coordinates and Panda3D’s.
How can I set one model in a position predefined in another model in Panda?

I don’t know anything about MAYA or MAYA coordinate systems, but perhaps this might help:

    self.SPforCar = self.startPoint.getPos( render )
    ... self.SPforCar )

Because car is parented to render, and so it’s position is relative to render.

enn0x, thank you. But it still doesn’t work. My car is still at where it was.

I moved it to the place where I’d like it to be at the beginning by arrow keys, and tried to get the position by I wrote down that point(Point3(-172, 82, 3)), then I changed my code to set the car at that point when loaded. The result is when I ran the code, the car is not at the place I want it be.
I thought maybe I kept down the wrong data. So I ran the code again, move the car to the point I want it to be at the beginning. However, this time, the point is not the same as the previus one. Then I ran a third time, same position, totally different number.
I’m so confused! Any suggestion will be greatly appreciated!

Hmm… I believe Panda3D to be deterministic. So same state => same numbers. Is the orientation of your car different when you get different numbers for position? Either this, or the sequence of actions you have done to move the car to the start position. But I have to admit I that don’t have a clue so far. Sorry.

Try using a Maya locator to define your point, instead of an ordinary node. Or, alternatively, use eggObjectFlags.mel to flag your ordinary point node with a “DCS” flag.

Either of these two will ensure that gets written into the egg file, which tells Panda that the transform on that particular node is meaningful. Otherwise Panda will optimize it away on loading.

However, Panda is pretty deterministic. If you’re seeing random behavior on different runs, I suspect you may be getting confused. :slight_smile:


Im really new to this so I apologize if my answer causes more problems! but maybe this would help:

<Group> start_point { 
  <DCS> { net } 
  <Transform> { 
    <Matrix4> { 
      1 0 0 0 
      0 1 0 0 
      0 0 1 0 
      0.0 0.0 1.7 1 
    <Translate> { 0 0 0 } 

…courtesy of tiptoe Oh BTW, I beleive you add this in the .egg file’s XML like structure at the end = loader.loadModel("Models/Environ.egg")
    self.startPoint ="**/StartPonit")
    self.SPforCar = self.startPoint.getPos()

With this code you’re reading a position relative to the coordinates of your environment model.
Of course this position is meaningless if you’re applying them to the world coordinates of another model.
So try to reparent your car to your environment model, or recalculate the position into world coordinates.