set procedural mesh position


22-05-2014 09:48:34

i have the position of 4 point , that create square ,
i want use this point to create cylinder or cube , or any thing in 3D
for exemple to create cylinder with those points i can use the top and button point to get the cylinder hight , to get the rudius from the two button point
but i have problem in the position how i can set the position of the cylinder?
that's my code
Ogre::Vector3 start(-36,90,104);
Ogre::Vector3 end(-46,85,81);
Ogre::Vector3 start1(-36,0,104);
Ogre::Vector3 end1(-46,0,81);

Ogre::Vector3 mid1((start+start1/2));
Ogre::Vector3 mid2((end+end1/2));
Ogre::Vector3 center((mid1+mid2/2));

ebody = mSceneMgr->createEntity("cyl");

pSNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("my cube");
pSNode->scale(Ogre::Vector3(0.04, 0.04, 0.04));

but as result , the hight isn't as i want, the ruduis and to position also :!:


04-07-2014 20:34:13

I haven't really understood what you're trying to achieve, but here :
Ogre::Vector3 mid1((start+start1/2));
Ogre::Vector3 mid2((end+end1/2));
Ogre::Vector3  center((mid1+mid2/2));

You're probably misplacing your pathensis, it should be, for example :
Ogre::Vector3  center((mid1+mid2)/2);