Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to select the Object3DData in the scene? #48

Closed
scolar opened this issue Apr 18, 2018 · 3 comments
Closed

how to select the Object3DData in the scene? #48

scolar opened this issue Apr 18, 2018 · 3 comments
Labels

Comments

@scolar
Copy link

scolar commented Apr 18, 2018

public void processTouch(float x, float y) {
	Object3DData objectToSelect = CollisionDetection.getBoxIntersection(getObjects(), parent.getgLView().getModelRenderer(), x, y);
	if (objectToSelect != null) {
		if (getSelectedObject() == objectToSelect) {
			Log.i("SceneLoader", "Unselected object " + objectToSelect.getId());
			setSelectedObject(null);
		} else {
			Log.i("SceneLoader", "Selected object " + objectToSelect.getId());
			setSelectedObject(objectToSelect);
		}
		float[] point = CollisionDetection.getTriangleIntersection2(getObjects(), parent.getgLView().getModelRenderer(), x, y);
		if (point != null) {
			addObject(Object3DBuilder.buildPoint(point).setColor(new float[]{1.0f,0f,0f,1f}));
		}
	}
}

why the objectToSelect is always null?

@andresoviedo
Copy link
Member

It shouldn't. objetToSelect is null only when touch (x,y) doesn't intersect any object.

What android / device are you using?

@andresoviedo
Copy link
Member

Hey. Do you still have the issue?

@rikapsu2018
Copy link

@andresoviedo I have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants