@Anton 我坚持这个翻转。
我从这里下载了项目。我有四个按钮,每个按钮将标题设置为 str 变量的右、左、下、顶。
在渲染初始旋转轴是 teapotNode_.rotationAxis = CC3VectorMake(0.1, 1, 0.3);
- (void)update:(float)dt
{
if ([str isEqualToString:@"right"])
{
teapotNode_.rotationAxis = CC3VectorMake(0.1, 1, 0.3);
angle +=2.0;
}
else if ([str isEqualToString:@"left"])
{
teapotNode_.rotationAxis = CC3VectorMake(0.1, 1, 0.3);
angle -=2.0;
}
else if ([str isEqualToString:@"bottom"])
{
teapotNode_.rotationAxis = CC3VectorMake(1,0,0);
angle +=2.0;
}
else if ([str isEqualToString:@"top"])
{
teapotNode_.rotationAxis = CC3VectorMake(1,0,0);
angle -=2.0;
}
else{
angle +=2.0;
}
teapotNode_.rotationAngle = angle;
}
我触摸顶部(或)向下旋转按钮更改轴,如 teapotNode_.rotationAxis = CC3VectorMake(1,0,0); 对象翻转。
我想要相同的轴位置将对象从上到下和从下到上旋转。