Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 36 additions & 24 deletions Assets/SteamVR/InteractionSystem/Core/Scripts/CircularDrive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,23 @@ public enum Axis_t
public TextMesh debugText = null;

[Tooltip( "The output angle value of the drive in degrees, unlimited will increase or decrease without bound, take the 360 modulus to find number of rotations" )]
public float outAngle;
[SerializeField]
private float outAngle;

public float OutAngle
{
get
{
return outAngle;
}
set
{
outAngle = value;
UpdateAll();
}
}

protected Hand.AttachmentFlags attachmentFlags = Hand.AttachmentFlags.DetachFromOtherHand;

private Quaternion start;

Expand Down Expand Up @@ -243,11 +259,9 @@ private void OnHandHoverEnd( Hand hand )
private void HandHoverUpdate( Hand hand )
{
GrabTypes startingGrabType = hand.GetGrabStarting();
bool isGrabEnding = hand.IsGrabbingWithType(grabbedWithType) == false;

if (grabbedWithType == GrabTypes.None && startingGrabType != GrabTypes.None)
if (interactable.attachedToHand == null && startingGrabType != GrabTypes.None)
{
grabbedWithType = startingGrabType;
// Trigger was just pressed
lastHandProjected = ComputeToTransformProjected( hand.hoverSphereTransform );

Expand All @@ -259,30 +273,28 @@ private void HandHoverUpdate( Hand hand )

driving = true;

ComputeAngle( hand );
UpdateAll();

hand.AttachObject(gameObject, startingGrabType, attachmentFlags);
hand.HideGrabHint();
}
else if (grabbedWithType != GrabTypes.None && isGrabEnding)
{
// Trigger was just released
if ( hoverLock )
{
hand.HoverUnlock(interactable);
handHoverLocked = null;
}
}
}

driving = false;
grabbedWithType = GrabTypes.None;
protected virtual void HandAttachedUpdate(Hand hand)
{
ComputeAngle(hand);
UpdateAll();

if (hand.IsGrabEnding(this.gameObject))
{
hand.DetachObject(gameObject);

if (hoverLock)
{
hand.HoverUnlock(interactable);
handHoverLocked = null;
}
}
}

if ( driving && isGrabEnding == false && hand.hoveringInteractable == this.interactable )
{
ComputeAngle( hand );
UpdateAll();
}
}


//-------------------------------------------------
Expand Down