Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Box creation and getting its location #12


I am kinda confused with box function to create a rigidobject box to the environment

def box(width,depth,height,center=None,R=None,t=None,world=None,name=None,mass=float('inf'),type='TriangleMesh')

First, I am not sure what's the difference between center and t. They both seems to be some locations. From my test, only center can be used to specify object's initial position and t cannot.

The second question is how to get this box's position in world coordinate. I use box.getTransform() and it seems that it is returning some offset w.r.t. its initial position, not the actual position in the world.

I guess the correct way is to not specify center, but use setTransform() to initialize box position?

  • replies 1
  • views 283
  • likes 0

The object has a reference frame, and if center is not zero, the geometry of the box will be created with that offset with respect of the reference frame. For most purposes, you want this to be zero.

However, you might for example want the object's reference frame to be at the corner of the geometry, in which case you'd set center to [width/2,depth/2,height/2].