Do I Have to use Casting?

Problems building or running the engine, queries about how to use features etc.
Post Reply
MarkD
Gnoblar
Posts: 2
Joined: Tue Feb 22, 2005 6:44 pm

Do I Have to use Casting?

Post by MarkD »

When i Do this:
Real MoveFactor = 80.0 * evt.timeSinceLastFrame;
mShipNode->yaw(MoveFactor);
I receiver an error of "Cannot convert Real to Radian", so i have to Cast the value of MoveFactor to "Radian", then the source stays this way:
Real MoveFactor = 80.0 * evt.timeSinceLastFrame;
mShipNode->yaw((Radian)MoveFactor);
Is there a better solution?
PS: I get this error in many places, especially when using lights!
User avatar
_mental_
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 419
Joined: Mon Jan 27, 2003 11:51 pm
Location: The Woodlands, TX
Contact:

Post by _mental_ »

Try the following:

mShipNode->yaw(Radian(MoveFactor));
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

This changed in 0.15.x - you have to use explicit Radian and Degree classes to be clear about what units you're using. The best way is not to cast, but to construct:

Code: Select all

mShipNode->yaw(Radian(MoveFactor));
[edit]damn, _mental_ beat me ;) [/edit]
User avatar
Emmeran
Goblin
Posts: 272
Joined: Wed Jun 02, 2004 11:47 am
Location: Erlangen
Contact:

Post by Emmeran »

you don't need to cast yourself... u could just do this:

Code: Select all

Radian MoveFactor = 80.0 * evt.timeSinceLastFrame;
mShipNode->yaw(MoveFactor); 
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

Actually the SceneNode methods interpreted Real values for angles as degree, so with the factors given in the tutorial Degree(MoveFactor) is better than Radian(MoveFactor). And casting here is highly unsave, because it depends on the Radian implementation. If it works it does so only by accident.
team-pantheon programmer
creators of Rastullahs Lockenpracht
MarkD
Gnoblar
Posts: 2
Joined: Tue Feb 22, 2005 6:44 pm

Post by MarkD »

Thanks for the Very Fast Help!!!!
:D
Post Reply