mirror of https://github.com/axmolengine/axmol.git
issue #5541: change RotateTo/RotateBy for Physics.
This commit is contained in:
parent
d7e7a73fec
commit
2fc8889791
|
@ -828,8 +828,19 @@ void RotateTo::update(float time)
|
|||
{
|
||||
if (_target)
|
||||
{
|
||||
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||
#if CC_USE_PHYSICS
|
||||
if (_target->getPhysicsBody() != nullptr && _startAngleX == _startAngleY && _diffAngleX == _diffAngleY)
|
||||
{
|
||||
_target->setRotation(_startAngleX + _diffAngleX * time);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif // CC_USE_PHYSICS
|
||||
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||
#if CC_USE_PHYSICS
|
||||
}
|
||||
#endif // CC_USE_PHYSICS
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -952,8 +963,19 @@ void RotateBy::update(float time)
|
|||
}
|
||||
else
|
||||
{
|
||||
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||
#if CC_USE_PHYSICS
|
||||
if (_target->getPhysicsBody() != nullptr && _startAngleZ_X == _startAngleZ_Y && _angleZ_X == _angleZ_Y)
|
||||
{
|
||||
_target->setRotation(_startAngleZ_X + _angleZ_X * time);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif // CC_USE_PHYSICS
|
||||
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||
#if CC_USE_PHYSICS
|
||||
}
|
||||
#endif // CC_USE_PHYSICS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue