如何在场景中缩放自定义对象(dae)?
How to scale a custom object (dae) in a scene?
我可以像这样将自定义对象插入到场景中,
NSURL *urlToColladaFile = [[NSBundle mainBundle] URLForResource:@"Assets.scnassets/vase-15k_saliency" withExtension:@"dae"];
SCNSceneSource *sceneSource = [SCNSceneSource sceneSourceWithURL:urlToColladaFile options:nil];
SCNNode *node = [sceneSource entryWithIdentifier:@"node" withClass:[SCNNode class]];
node.physicsBody = [SCNPhysicsBody bodyWithType:SCNPhysicsBodyTypeDynamic shape:nil];
node.physicsBody.mass = 2.0;
node.physicsBody.categoryBitMask = CollisionCategoryCube;
node.position = position;
node.scale = SCNVector3Make(0.1,0.1,0.1);
比例尺使对象看起来很小,但几何图形仍保持其原始大小。我怎样才能缩放几何图形来制作对象 large/small?
我应该使用 node.transform 吗?或 node.pivot?请任何指点有帮助。
添加比例和根据比例计算的变换是相同的:
The transformation is the combination of the node’s
rotation, position, and scale properties. The default transformation is SCNMatrix4Identity.
When you set the value of this property, the node’s rotation, orientation, eulerAngles, position, and scale properties automatically change to match the new transform, and vice versa.
枢轴 属性 具有相同的效果,但仅当您需要节点坐标 space 及其变换之间的偏移量时才应使用它。
如果您想要不同大小的几何图形,您可以将其导出为较小的大小,但这应该会产生相同的效果。
如果您出于性能原因希望渲染更少的多边形,请查看 SCNLevelOfDetail
我可以像这样将自定义对象插入到场景中,
NSURL *urlToColladaFile = [[NSBundle mainBundle] URLForResource:@"Assets.scnassets/vase-15k_saliency" withExtension:@"dae"];
SCNSceneSource *sceneSource = [SCNSceneSource sceneSourceWithURL:urlToColladaFile options:nil];
SCNNode *node = [sceneSource entryWithIdentifier:@"node" withClass:[SCNNode class]];
node.physicsBody = [SCNPhysicsBody bodyWithType:SCNPhysicsBodyTypeDynamic shape:nil];
node.physicsBody.mass = 2.0;
node.physicsBody.categoryBitMask = CollisionCategoryCube;
node.position = position;
node.scale = SCNVector3Make(0.1,0.1,0.1);
比例尺使对象看起来很小,但几何图形仍保持其原始大小。我怎样才能缩放几何图形来制作对象 large/small?
我应该使用 node.transform 吗?或 node.pivot?请任何指点有帮助。
添加比例和根据比例计算的变换是相同的:
The transformation is the combination of the node’s rotation, position, and scale properties. The default transformation is SCNMatrix4Identity. When you set the value of this property, the node’s rotation, orientation, eulerAngles, position, and scale properties automatically change to match the new transform, and vice versa.
枢轴 属性 具有相同的效果,但仅当您需要节点坐标 space 及其变换之间的偏移量时才应使用它。
如果您想要不同大小的几何图形,您可以将其导出为较小的大小,但这应该会产生相同的效果。
如果您出于性能原因希望渲染更少的多边形,请查看 SCNLevelOfDetail