I show the 3D object in ArFragment. So I put .obj file and .mtl file at sampledata folder. And I right click on obj file, and select Import Sceneform Asset to add .sfa / .sfb file.
So I can show the 3d object when I mark the image, but the object is too big.
This is my .sfa file detail
{
bound_relative_root: {
x: 0.5,
y: 0,
z: 0.5,
},
materials: [
{
name: "Material.001",
parameters: [
{
baseColor: null,
},
{
baseColorTint: [
0.80000000000000004,
0.80000000000000004,
0.80000000000000004,
1,
],
},
{
metallic: 1,
},
{
roughness: 0.120695,
},
{
opacity: null,
},
],
source: "build/sceneform_sdk/default_materials/obj_material.sfm",
},
],
model: {
attributes: [
"Position",
"TexCoord",
"Orientation",
],
collision: {},
file: "sampledata/dongbaek.obj",
name: "dongbaek",
recenter: "root",
scale: 0.200000
},
version: "0.52:1",
}
I think it can resize by scale part, but I change the value, it dosen't change. same size
So How I can resize 3d object?
Is there any problem at add 3d object file to make .sfa / .sfb file?(Import Sceneform Asset)
If you know about it, please help me.
Different approaches depending on your project:
Object scaling is changed by the Scale Controller. By setting minScale and maxScale value. Before setting parent - anchor node. See example below.
// Create the Anchor.
Anchor anchor = hitResult.createAnchor();
AnchorNode anchorNode = new AnchorNode(anchor);
anchorNode.setParent(arFragment.getArSceneView().getScene());
// Create the transformable andy and add it to the anchor.
TransformableNode node = new TransformableNode(arFragment.getTransformationSystem());
// Maxscale must be greater than minscale
node.getScaleController().setMaxScale(0.02f);
node.getScaleController().setMinScale(0.01f);
node.setParent(anchorNode);
node.setRenderable(renderable);
node.select();
Use the following code to resize your model in ARCore:
TransformationSystem transSys;
transSys = MainActivity.getArFragment().getTransformationSystem();
TransformableNode myNode = new TransformableNode(transSys);
myNode.setLocalScale(new Vector3(0.25f, 0.25f, 0.25f));
myNode.setParent(anchorNode);
//myNode.setParent(sceneView.getScene());
myNode.setRenderable(myModelRenderable);
sceneView.getScene().addChild(node);
myNode.select();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With