我正在尝试在GVRSphereSceneObject
中的GearVR
上显示点/指针。但是,一旦GVRSphereSceneObject
就会显示纹理图像可见后场景对象隐藏的位置。如果我使用addSceneObject
添加球体和对象,则图像会显示在一侧,其余的视线则会变黑。
我找不到与此相关的任何问题,还尝试了一些示例。任何帮助将不胜感激。
这是在球体上添加对象的代码。
Future<GVRTexture> texture = gvrContext.loadFutureTexture(new GVRAndroidResource(gvrContext, R.raw.pano));
GVRMaterial material = new GVRMaterial(gvrContext);
material.setMainTexture(texture);
boom = new GVRSphereSceneObject(gvrContext, 18, 36, false, material);
Pointer = new GVRSceneObject(gvrContext,
new FutureWrapper<>(gvrContext.createQuad(0.05f, 0.05f)),
gvrContext.loadFutureTexture(new GVRAndroidResource(this.gvrContext, R.drawable.target)));
Pointer.getRenderData().getMaterial().setColor(Colors.RED[0], Colors.RED[1], Colors.RED[2]);
Pointer.getTransform().setPosition(0.0f, 0.0f, -1.0f);
Pointer.setName("Pointer");
boom.addChildObject(Pointer);
scene.addSceneObject(boom);
答案 0 :(得分:0)
如果有人为此而苦苦挣扎。请查看this issue。
override func viewDidLoad() { super.viewDidLoad() //Setup stackView let myStackView = UIStackView() myStackView.axis = .horizontal myStackView.alignment = .center myStackView.distribution = .fillEqually myStackView.spacing = 8 view.addSubview(myStackView) //Setup circles let circle_1 = circleLabel() let circle_2 = circleLabel() let circle_3 = circleLabel() myStackView.addArrangedSubview(circle_1) myStackView.addArrangedSubview(circle_2) myStackView.addArrangedSubview(circle_3) myStackView.translatesAutoresizingMaskIntoConstraints = false myStackView.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0.0).isActive = true myStackView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0.0).isActive = true } func circleLabel() -> UILabel { let label = UILabel() label.backgroundColor = UIColor.red label.layer.cornerRadius = 12.5 label.layer.masksToBounds = true label.layer.borderColor = UIColor.orange.cgColor label.layer.borderWidth = 3.0 label.widthAnchor.constraint(equalToConstant: 25.0).isActive = true label.heightAnchor.constraint(equalToConstant: 25.0).isActive = true return label }