Files
old-profesor-atom/Profesor Atom/Library/metadata/ad/ad77666522338cf49ba83b80b25e6476

196 lines
9.5 KiB
Plaintext
Raw Normal View History

2017-05-17 12:25:25 +03:00
w%<25>5.6.1f1<00><><EFBFBD><EFBFBD><00><><EFBFBD>0<05><><EFBFBD><EFBFBD>L.`?^<5E>0D7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00><00><00><00><00><00><00><00><00>#<00><00>+H<00>3<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00> Q<00>j<00>
<00><00>< <00><00>H H<00>Z<00><><EFBFBD><EFBFBD> <00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00><00><00>g<00><00><00><00><00><00>#<00><00>+v~<00><00><><00><00><><00><00><><00><00><><00><00><><00><00><><00><00><><00><00><><00><00><><00><00><> <00><00><>!<00><00><>"<00><00><>#<00><00>$<00><00>%<00><00>&<00><00>#<00><><EFBFBD><EFBFBD>'<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(<00><00><00><00>)H<00>j<00><><EFBFBD><EFBFBD><EFBFBD>*<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>+@<00><00><00>,Q<00>j<00>-<00><00>*.<00><00>8/AssetMetaDataguiddata[0]data[1]data[2]data[3]pathNametimeCreatedoriginalChangesetoriginalNameoriginalParentHash128originalDigestbytes[0]bytes[1]bytes[2]bytes[3]bytes[4]bytes[5]bytes[6]bytes[7]bytes[8]bytes[9]bytes[10]bytes[11]bytes[12]bytes[13]bytes[14]bytes[15]labelsassetStoreReflicenseType <00><>z{<0E>@<40><05><>5^(<28>H'<00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00> <00><00> <00><00>#.<00>,<00><00><><00> <00><00>#.<00>,H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00>
Q<00>j<00> <00><00>5<00><><EFBFBD><EFBFBD> <00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> <00><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>#.<00>, <00>I@<00><00>X @<00><00>#.<00>,H<00>]<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00>h<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00>!Q<00>j<00>"H<00>z<00><><EFBFBD><EFBFBD>#<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$@<00><00><00>%Q<00>j<00>&MonoImporterPPtr<EditorExtension>m_FileIDm_PathIDm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants<00><><EFBFBD>8-l'<27><>愁h<E68481>ΐA,<00><00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00><00><00> <00><00>.<00><00><00><><00> <00><00>.<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00>
Q<00>j<00> H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00>Q<00>j<00><00><00>(<00><><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><01><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><01>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>.<00>y<00>< <00><00>.<00><00><00>CH<00>T<00><><EFBFBD><EFBFBD><10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00>!Q<00>j<00>"H<00>`<00><><EFBFBD><EFBFBD>#<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$@<00><00><00>%Q<00>j<00>&H<00>l<00><><EFBFBD><EFBFBD>'<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(@<00><00><00>)Q<00>j<00>*L<00>{+PPtr<EditorExtension>m_FileIDm_PathIDm_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespacem_AssemblyNamem_IsEditorScript<00><00>@<00>y<EFBFBD><00><00><00><>^\a<><61>M<EFBFBD>Q<EFBFBD>| <09>e.<00>wfV"3<>O<EFBFBD><4F><EFBFBD>+<2B>FgAAssets/SteamVR/InteractionSystem/Core/Scripts/ComplexThrowable.cs2<02>U<00><>*ComplexThrowable\//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Throwable that uses physics joints to attach instead of just
// parenting
//
//=============================================================================
using UnityEngine;
using System.Collections.Generic;
namespace Valve.VR.InteractionSystem
{
//-------------------------------------------------------------------------
[RequireComponent( typeof( Interactable ) )]
public class ComplexThrowable : MonoBehaviour
{
public enum AttachMode
{
FixedJoint,
Force,
}
public float attachForce = 800.0f;
public float attachForceDamper = 25.0f;
public AttachMode attachMode = AttachMode.FixedJoint;
[EnumFlags]
public Hand.AttachmentFlags attachmentFlags = 0;
private List<Hand> holdingHands = new List<Hand>();
private List<Rigidbody> holdingBodies = new List<Rigidbody>();
private List<Vector3> holdingPoints = new List<Vector3>();
private List<Rigidbody> rigidBodies = new List<Rigidbody>();
//-------------------------------------------------
void Awake()
{
GetComponentsInChildren<Rigidbody>( rigidBodies );
}
//-------------------------------------------------
void Update()
{
for ( int i = 0; i < holdingHands.Count; i++ )
{
if ( !holdingHands[i].GetStandardInteractionButton() )
{
PhysicsDetach( holdingHands[i] );
}
}
}
//-------------------------------------------------
private void OnHandHoverBegin( Hand hand )
{
if ( holdingHands.IndexOf( hand ) == -1 )
{
if ( hand.controller != null )
{
hand.controller.TriggerHapticPulse( 800 );
}
}
}
//-------------------------------------------------
private void OnHandHoverEnd( Hand hand )
{
if ( holdingHands.IndexOf( hand ) == -1 )
{
if ( hand.controller != null )
{
hand.controller.TriggerHapticPulse( 500 );
}
}
}
//-------------------------------------------------
private void HandHoverUpdate( Hand hand )
{
if ( hand.GetStandardInteractionButtonDown() )
{
PhysicsAttach( hand );
}
}
//-------------------------------------------------
private void PhysicsAttach( Hand hand )
{
PhysicsDetach( hand );
Rigidbody holdingBody = null;
Vector3 holdingPoint = Vector3.zero;
// The hand should grab onto the nearest rigid body
float closestDistance = float.MaxValue;
for ( int i = 0; i < rigidBodies.Count; i++ )
{
float distance = Vector3.Distance( rigidBodies[i].worldCenterOfMass, hand.transform.position );
if ( distance < closestDistance )
{
holdingBody = rigidBodies[i];
closestDistance = distance;
}
}
// Couldn't grab onto a body
if ( holdingBody == null )
return;
// Create a fixed joint from the hand to the holding body
if ( attachMode == AttachMode.FixedJoint )
{
Rigidbody handRigidbody = Util.FindOrAddComponent<Rigidbody>( hand.gameObject );
handRigidbody.isKinematic = true;
FixedJoint handJoint = hand.gameObject.AddComponent<FixedJoint>();
handJoint.connectedBody = holdingBody;
}
// Don't let the hand interact with other things while it's holding us
hand.HoverLock( null );
// Affix this point
Vector3 offset = hand.transform.position - holdingBody.worldCenterOfMass;
offset = Mathf.Min( offset.magnitude, 1.0f ) * offset.normalized;
holdingPoint = holdingBody.transform.InverseTransformPoint( holdingBody.worldCenterOfMass + offset );
hand.AttachObject( this.gameObject, attachmentFlags );
// Update holding list
holdingHands.Add( hand );
holdingBodies.Add( holdingBody );
holdingPoints.Add( holdingPoint );
}
//-------------------------------------------------
private bool PhysicsDetach( Hand hand )
{
int i = holdingHands.IndexOf( hand );
if ( i != -1 )
{
// Detach this object from the hand
holdingHands[i].DetachObject( this.gameObject, false );
// Allow the hand to do other things
holdingHands[i].HoverUnlock( null );
// Delete any existing joints from the hand
if ( attachMode == AttachMode.FixedJoint )
{
Destroy( holdingHands[i].GetComponent<FixedJoint>() );
}
Util.FastRemove( holdingHands, i );
Util.FastRemove( holdingBodies, i );
Util.FastRemove( holdingPoints, i );
return true;
}
return false;
}
//-------------------------------------------------
void FixedUpdate()
{
if ( attachMode == AttachMode.Force )
{
for ( int i = 0; i < holdingHands.Count; i++ )
{
Vector3 targetPoint = holdingBodies[i].transform.TransformPoint( holdingPoints[i] );
Vector3 vdisplacement = holdingHands[i].transform.position - targetPoint;
holdingBodies[i].AddForceAtPosition( attachForce * vdisplacement, targetPoint, ForceMode.Acceleration );
holdingBodies[i].AddForceAtPosition( -attachForceDamper * holdingBodies[i].GetPointVelocity( targetPoint ), targetPoint, ForceMode.Acceleration );
}
}
}
}
}
<00><>*ComplexThrowableValve.VR.InteractionSystemAssembly-CSharp.dll