1
我想从主摄像头视图向前放置一个UIView在Z轴上。我添加了如下所示的代码。我正在尝试使用CATransform3DTranslate,但JAPanoView(其视图)不会显示在提到的Z轴值转发到相机视图。有人可以请指教,我该如何实现它?Z轴支持查看UIView
-(void) initializeScene {
// Create the camera, place it back a bit, and add it to the scene
CC3Camera* cam = [CC3Camera nodeWithName: @"Camera"];
cam.location = cc3v(0.0, 0.0, 12.0);
[self addChild: cam];
// Create a light, place it back and to the left at a specific
// position (not just directional lighting), and add it to the scene
CC3Light* lamp = [CC3Light nodeWithName: @"Lamp"];
lamp.location = cc3v(0.0, 40.0, 0.0);
lamp.isDirectionalOnly = NO;
[cam addChild: lamp];
// JAPanoView IS AN UIVIEW
JAPanoView *panoView=[[JAPanoView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
//self.view=panoView;
panoView.delegate=self;
[panoView setFrontImage:[UIImage imageNamed:@"Home_front.png"] rightImage:[UIImage imageNamed:@"Home_right.png"] backImage:[UIImage imageNamed:@"Home_back.png"] leftImage:[UIImage imageNamed:@"Home_left.png"] topImage:[UIImage imageNamed:@"Home_up.png"] bottomImage:[UIImage imageNamed:@"Home_down.png"]];
CATransform3D _3Dt = CATransform3DIdentity;
_3Dt = CATransform3DTranslate(_3Dt, 0, 0, -30);
panoView.layer.transform = _3Dt;
[[[CCDirector sharedDirector] openGLView] addSubview:panoView];
// Create OpenGL ES buffers for the vertex arrays to keep things fast and efficient,
// and to save memory, release the vertex data in main memory because it is now redundant.
[self createGLBuffers];
[self releaseRedundantData];
}
试试用一个普通的UIButton。一般来说,可能无法在UIView上执行3D转换。或者在添加视图后尝试应用转换。这是我想尝试的两件事。 – LearnCocos2D
我在视图中添加后尝试转换,但它不能解决问题。 – Getsy
我的示例项目是在这里 - > https://www.hightail.com/download/bWJyYUluT2IzS3FLRmNUQw – Getsy