• 13
• 18
• 19
• 27
• 9

# Confusion

This topic is 2665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've small doubt

consider if I created a cylinder in DirectX

and I set that cylinder position to (10,10,10)

so tell me what is the center point of that cylinder?

##### Share on other sites
When ever you position something, the position is usually the center of the object. In this case, the center is 10 10 10

##### Share on other sites
Hey there,

What are you using to create the cylinder?

If you are loading it from a model file, whatever the "origin" is inside of the model file is what will be at (10,10,10) when you place it.

So for instance if you made a model of a cylinder where the origin (0,0,0) was at the center of the cylinder, when you placed it in your program at (10,10,10), the center of the cylinder would be at (10,10,10).

If, however, you made the model such that in your modeling program, the cylinder was resting on the "ground plane" (ie X and Z = 0), when you placed it in your program at (10,10,10), the BOTTOM of the cylinder would be at (10,10,10) and the middle would be up a little ways (1/2 the height of your cylinder from there).

LPD3DXMESH mesh;//your cylinder mesh previously loadedD3DXVECTOR3 center;float radius;D3DXVECTOR3* pPos;mesh->LockVertexBuffer(0, (LPVOID*)&pPos);D3DXComputeBoundingSphere(pPos, mesh->GetNumVertices(),mesh->GetNumBytesPerVertex(), ¢er, &radius);mesh->UnlockVertexBuffer()