ogre::real in Mogre

crankyslap

30-09-2012 10:58:23

I was looking how to find a simple distance between two Vector3's and I found this on the Ogre forums:

Ogre::Vector3 a = Ogre::Vector3(1, 2, 3);
Ogre::Vector3 b = Ogre::Vector3(4, 5, 6);
Ogre::Real r = a.distance(b);

But I can't seem to find Ogre::Real in the Mogre wrapper... does it exist? And if not, is there an alternative built in?

smiley80

30-09-2012 22:15:27

Real is a typedef for float. 'Distance' is missing from Mogre's Vector3, but you can do:
Vector3 a = new Vector3(1, 2, 3);
Vector3 b = new Vector3(4, 5, 6);
float r = (a - b).Length;

crankyslap

01-10-2012 15:50:06

Thanks smiley, does the trick :D