Comments (5)
Please suggest a way to rotate Views on the X and Y axis.
from sceneform-android-sdk.
The expected axis for rotation controller is the normal "sticking out" of a plane. This looks different for vertical vs horizontal planes since the normal will be horizontal or vertical respectively.
To get the same behavior between walls & tabletops I might insert a new node as a parent that rotates the axis of rotation from horizontal to vertical when given a vertical plane. Or you could skip the new parent and directly set the rotation as you did in your code above.
The Transformation System was designed for horizontal user experiences. We worked closely with our UX designers and researchers to design it in Sceneform 1.0.
As a matter of style, I don't think it translates to vertical tasks without making a lot more changes than changing the axis of rotation. Updating the UX for vertical interfaces will have to be something we do for a future releases.
from sceneform-android-sdk.
Thanks for the feedback! Right now, the transformation controllers are geared towards transformations on horizontal planes. Can you describe the use case where you are running into a problem?
Currently, the RotationController works by rotating the Node along it's local y-axis. If the node is a child of an AnchorNode anchored to an ARCore plane, then the normal direction of the node should match the normal direction of the plane.
Thanks,
Dan
from sceneform-android-sdk.
The snippet I'm using is:
arFragment.setOnTapArPlaneListener(
(HitResult hitResult, Plane plane, MotionEvent motionEvent) -> {
if (mCards.isEmpty()) {
return;
}
// Create the Anchor.
Anchor anchor = hitResult.createAnchor();
AnchorNode anchorNode = new AnchorNode(anchor);
anchorNode.setParent(arFragment.getArSceneView().getScene());
TransformableNode cardNode = new TransformableNode(arFragment.getTransformationSystem());
ScaleController scaleController = cardNode.getScaleController();
scaleController.setMinScale(0.01f);
scaleController.setMaxScale(0.1f);
scaleController.setSensitivity(0.4f);
Card firstCard = mCards.get(mLastCardSelectionIndex);
ViewRenderable.builder()
.setView(context, getCardView(context, firstCard))
.build()
.thenAccept(
(viewRenderable) -> {
cardNode.setRenderable(viewRenderable);
// Change the rotation
if (plane.getType() == Plane.Type.VERTICAL) {
float[] yAxis = plane.getCenterPose().getYAxis();
Vector3 planeNormal = new Vector3(yAxis[0], yAxis[1], yAxis[2]);
Quaternion upQuat = Quaternion.lookRotation(planeNormal, Vector3.up());
cardNode.setWorldRotation(upQuat);
}
}
)
.exceptionally(
(throwable -> {
throw new AssertionError("Could not load card view renderable.", throwable);
})
);
cardNode.setParent(anchorNode);
cardNode.select();
mLastCardSelectionIndex = (mLastCardSelectionIndex + 1) % mCards.size();
});
The original issue was that ViewRenderable
was "sticking out" of the vertical surface, which doesn't make sense for a view intended to be read. So I changed its world rotation to be readable to someone looking at the ViewRenderable
, i.e. laying it flat on the vertical surface.
Below is the world rotation corrected view renderables (the 3 cards)
And here is what they look like rotated:
from sceneform-android-sdk.
Closing due to inactivity.
from sceneform-android-sdk.
Related Issues (20)
- Null object
- How to find angle of model from localRotation?
- two modelRenderable overlapping will flicker HOT 1
- [SceneForm v1.16.0 breakage] Not AndroidX ready
- [SceneForm v1.16.0 breakage] no maven dep
- [SceneForm v1.16.0 breakage] ViewRenderables not working HOT 1
- available configuration for avoiding too much heat on device
- GLTF's UV scale functionality not implemented in 1.16.0?
- Object is moving along when i move the phone ?! HOT 5
- ArSceneView have some black dot
- Sceneform plugin:1.15.0 with Android Studio 3.6 not working at all HOT 5
- [SceneForm v1.16.0 breakage] chromakey video
- Cannot load GLB file at Runtime using canonical face
- Is there a way to generate .sfb files from .fbx in runtime HOT 2
- Work with Canonical Face Mesh in Blender
- SceneForm Uses 100% RAM HOT 3
- Update Filament to v1.6.0 (filament-android:1.6.0 & gltfio-android:1.6.0) HOT 1
- How To Show Normal Texture in UV1?
- How can I import model asset the obj file?
- ArFragment leaking after parent activity finished
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sceneform-android-sdk.