Rotating the Studio Environment

In this example, you will see how to use vrdEnvironmentTransformation when rotating a studio (Sphere) environment.

Note:

While objects have many functions to query and change properties, the main entry point when working with Python is through the services to get the objects you want to work with.

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}')