Replacing Real variable from C++ code

pin

05-04-2007 13:34:56

I'm trying to port a snippet that uses Ogre::Real. There's no such variable in the C# version how do I replace it?

i.e how would this look in C#



Real mWalkSpeed;
bool mWalking; // whether the robot is walking
Ogre::Real mDistance; // the distance to a destination point
Ogre::Vector3 mDirection; // the movement direction
Ogre::Vector3 mDestination; // the destination vector

if ( mWalking )
{
Real move = mWalkSpeed * evt.timeSinceLastFrame;
mDistance -= move;
// if we reach a waypoint, check for the next location
if (mDistance <= 0.0f)
{
mNode->setPosition( mDestination );
mDirection = Vector3::ZERO;

if (! nextLocation( ) )
{
// no other locations found, Idle
setAnimationState(true, true, "Idle");
mWalking = false;

} // if
} // if
else // if we are inbetween waypoints, move toward the next one
{
mNode->translate( mDirection * move );
} // else

// make sure we are walking on the ground
//testGround();

}


I more interested in this lines:
Real move = mWalkSpeed * evt.timeSinceLastFrame;
mNode->translate( mDirection * move );


thx

ColorWolf

05-04-2007 13:52:19

hi,

Real is just a Float. Nothing fancy :)

lancore89

05-04-2007 13:52:41

Real is just a typedef for float.

float move = mWalkSpeed * evt.timeSinceLastFrame;
mNode.Translate( mDirection * move );

pin

05-04-2007 13:54:27

Thanks for a quick reply.

bleubleu

12-04-2007 15:58:37

If you are even lazier, you could put something like in your code:

using Real = System.Single;


But all those Ogre::Real will still be problematic. Better to search and replace I guess.

Mat