# Proportion of pixel to unit

How many pixels are a unit?

I have a texture of 512x512 and I need to know how many units it is.

By units I mean, a single unit of space used in Panda.

there is absolutely no relationship between panda-units and pixels since pixels neither have a size, nor a scale.
if you’r talking about geomipterrain… i think it’s default size if parented to render is 1x1 panda unit.(might be one unit per pixel,too i’m not terribly sure).

That’s not true, if you analise Roaming Ralph example, the terrain uses a 512x512 texture, that does not have 512x512 units, I tested it by changing the texture for another one easier to check this.

Im wondering how do I know the proportion, and if its not fixed, where in the panda library can I get this proportion.

I think it depends on Scale of world, dont know.

Im in the same problem about how do I get the color of the texture of the floor in that point, I extracted the texture, now I have to transform the position of the collision, to a position in the 512x512 of the texture, with precision.

I though that all I need to do is get the mod of collision position by 512 that is both x and y length of the texture. If it were only this, would be much much easier.

pixels themselves just have no scale or coordinates.
where the appear in your map highly depends on your UV-layout, the UV-scale, the UV-offset, the texture resolution, the model geometry and all its transforms. to be really precise we’r even talking about texels (not even pixels).

long story short. it’s totaly up to you. if you have a plane going from 0,0 to 1,1 and you have a 128x128 texture. you can simply do int(getX()*128) to get the pixel index in question (unless your uv-map is scaled, rotated, shifted or mirrored).
you can always get your node’s position relative to the floor-coordinate system. which allows you to easily scale and transform the floor without beeing forced to use nasty math.

And how do I get the node’s position relative to the floor coordinate?

That probably will solve the problem, thanks for answering some of my questions, I started on Panda there is not many time, so I have a long way to go.

yourNode.getPos( yourFloorNode )