API reference
API reference
Select your platform
No SDKs available
No versions available

OVRFace Class

Extends MonoBehaviour
Drives blend shapes on a SkinnedMeshRenderer based on the face tracking data provided by OVRFaceExpressions.
This is done by taking in face tracking weights (an array of weights based on the Facial Action Coding System (FACS)), and applying it to a SkinnedMeshRenderer by updating the blend shapes on the SkinnedMeshRenderer every frame. As the values from the face tracking data may differ in range from the blend shape range on the skinned mesh renderer, a modification of values is required by setting the OVRFace.BlendShapeStrengthMultiplier which will multiply the input before setting the blend shape values on the SkinnedMeshRenderer. For more information, please see Face Tracking for Movement SDK for Unity.
Intended to be used as a base type that is inherited from in order to provide mapping logic from blend shape indices. The mapping of OVRFaceExpressions.FaceExpression to blend shapes is accomplished by overriding OVRFace.GetFaceExpression(int). Needs to be linked to a OVRFaceExpressions component to fetch tracking data from.

Protected Properties

SkinnedMesh : SkinnedMeshRenderer
[Get]
The SkinnedMeshRenderer which contains the blend shapes that will be updated with the face tracking weights from OVRFaceExpressions.
Signature
SkinnedMeshRenderer SkinnedMesh

Properties

BlendShapeStrengthMultiplier : float
[Get][Set]
The multiplier applied on the OVRFaceExpressions tracking weights as they are mapped to blend shapes on the SkinnedMeshRenderer.
This is needed as the blend shape range in Unity can vary based on the model (i.e. 0-100), while the weights from face tracking range from 0-1.
Signature
float BlendShapeStrengthMultiplier
FaceExpressions : OVRFaceExpressions
[Get][Set]
The reference to the OVRFaceExpressions component, which contains the face tracking weights to be applied to the blend shapes on the skinned mesh renderer.
Signature
OVRFaceExpressions FaceExpressions

Protected Methods

Awake ()
Signature
virtual void Awake()
Returns
void
Start ()
Signature
virtual void Start()
Returns
void
Update ()
Signature
virtual void Update()
Returns
void

Inner Interface

IMeshWeightsProvider Interface

Interface to define a custom blendshape weights provider for a skinned mesh.
Implement this interface if you wish to store the blendshape weights in a separate components for processing via IMeshWeightsProvider.UpdateWeights(OVRFaceExpressions) and later retrieval via GetWeightValue(int, out float).

Methods

GetWeightValue ( blendshapeIndex , weightValue )
Obtains a weight value for a given blendshape index; return a boolean based on if the call was successful or not.
Use this to obtain the weight value from a provider after IMeshWeightsProvider.UpdateWeights(OVRFaceExpressions) was called.
Signature
bool GetWeightValue(int blendshapeIndex, out float weightValue)
Parameters
blendshapeIndex: int  Blendshape index on skinned mesh renderer.
weightValue: out float  Output weight value.
Returns
bool  True if successful, false if not.
UpdateWeights ( faceExpressions )
Updates the weights value, passed in from a OVRFaceExpressions instance.
You may use to possibly store incoming weights for later modification.
Signature
void UpdateWeights(OVRFaceExpressions faceExpressions)
Parameters
faceExpressions: OVRFaceExpressions OVRFaceExpressions instance.
Returns
void