public void UpdateInstance() { INTERACTION_TRANSFORM transform = new INTERACTION_TRANSFORM(); transform.position = Vector3.one.ToCVector(); transform.rotation = Quaternion.identity.ToCQuaternion(); transform.wallTime = 0; INTERACTION_UPDATE_SHAPE_INFO info = new INTERACTION_UPDATE_SHAPE_INFO(); info.angularAcceleration = Vector3.zero.ToCVector(); info.angularVelocity = Vector3.zero.ToCVector(); info.linearAcceleration = Vector3.zero.ToCVector(); info.linearVelocity = Vector3.zero.ToCVector(); InteractionC.UpdateShapeInstance(ref _scene, ref transform, ref info, ref _shapeInstanceHandle); }
public override void GetInteractionShapeUpdateInfo(out INTERACTION_UPDATE_SHAPE_INFO updateInfo, out INTERACTION_TRANSFORM interactionTransform) { updateInfo = new INTERACTION_UPDATE_SHAPE_INFO(); updateInfo.updateFlags = UpdateInfoFlags.VelocityEnabled; updateInfo.linearVelocity = _rigidbody.velocity.ToCVector(); updateInfo.angularVelocity = _rigidbody.angularVelocity.ToCVector(); if (_isKinematic) { updateInfo.updateFlags |= UpdateInfoFlags.Kinematic; } else { // Generates notifications even when hands are no longer influencing if (_contactMode == ContactMode.SOFT) { updateInfo.updateFlags |= UpdateInfoFlags.SoftContact; } // All forms of acceleration. if (_contactMode != ContactMode.GRASPED) { updateInfo.updateFlags |= UpdateInfoFlags.AccelerationEnabled; updateInfo.linearAcceleration = _accumulatedLinearAcceleration.ToCVector(); updateInfo.angularAcceleration = _accumulatedAngularAcceleration.ToCVector(); if (_useGravity) { updateInfo.updateFlags |= UpdateInfoFlags.GravityEnabled; } } } interactionTransform = getRigidbodyTransform(); }
/// <summary> /// Called by InteractionManager to get the update info needed to update the internal state of the object. /// </summary> public abstract void GetInteractionShapeUpdateInfo(out INTERACTION_UPDATE_SHAPE_INFO updateInfo, out INTERACTION_TRANSFORM interactionTransform);