在本示例中,您将了解如何在旋转 Studio(球体)环境时使用 vrdEnvironmentTransformation
。
虽然对象具有许多用于查询和更改属性的函数,但使用 Python 时的主要入口点是通过服务来获取要使用的对象。
print(f'\n### NOTE: Using vrMaterialService as INITIAL ENTRY POINT. ####')
# Get APIV2 vrdSphereEnvironmentMaterial object
studio_v2 = vrMaterialService.findMaterial('Studio')
print(f'vrdSphereEnvironmentMaterial:\n\t{studio_v2}')
# Get APIV2 vrdEnvironmentTransformation object
studio_v2_transform = studio_v2.getTransformation()
print(f'vrdEnvironmentTransormation:\n\t{studio_v2_transform}')
# Get APIV2 XYZ rotation values
studio_v2_rotation = studio_v2_transform.getRotate()
print(f'Rotation X, Y, Z:\n\t{studio_v2_rotation}')
# Get APIV2 Z axis rotation value
studio_v2_z_rotation = studio_v2_rotation.z()
print(f'Current Z axis rotation:\n\t{studio_v2_z_rotation}')
# Increment rotation value
rotation_step = studio_v2_z_rotation + 10.0
# Set APIV2 rotation Z value
studio_v2_transform.setRotate(QVector3D(0.0, 0.0, rotation_step))
print(f'New Z axis rotation:\n\t{rotation_step}')