first commit
This commit is contained in:
8
Assets/Materials/JusticeScale/Demo/Materials.meta
Normal file
8
Assets/Materials/JusticeScale/Demo/Materials.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 282a0ccb827d994479810da8b5dde61a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
128
Assets/Materials/JusticeScale/Demo/Materials/Gray.mat
Normal file
128
Assets/Materials/JusticeScale/Demo/Materials/Gray.mat
Normal file
@@ -0,0 +1,128 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Gray
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _Blend: 0
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Surface: 0
|
||||
- _UVSec: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.23423356, g: 0.23139185, b: 0.26037726, a: 1}
|
||||
- _Color: {r: 0.23423353, g: 0.23139182, b: 0.26037723, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &7091203286646534079
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 5
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5927a6e33f31f7649992673def661779
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Materials/JusticeScale/Demo/Models.meta
Normal file
8
Assets/Materials/JusticeScale/Demo/Models.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab797149bfc715e4d8eec15c9a88289d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Materials/JusticeScale/Demo/Models/Kettlebell.fbx
Normal file
BIN
Assets/Materials/JusticeScale/Demo/Models/Kettlebell.fbx
Normal file
Binary file not shown.
107
Assets/Materials/JusticeScale/Demo/Models/Kettlebell.fbx.meta
Normal file
107
Assets/Materials/JusticeScale/Demo/Models/Kettlebell.fbx.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9fdcd8ba368330488bc6d2193f8282f
|
||||
ModelImporter:
|
||||
serializedVersion: 22200
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
materials:
|
||||
materialImportMode: 2
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
removeConstantScaleCurves: 0
|
||||
motionNodeName:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
importConstraints: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
useSRGBMaterialColor: 1
|
||||
sortHierarchyByName: 1
|
||||
importPhysicalCameras: 1
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
nodeNameCollisionStrategy: 1
|
||||
fileIdsGeneration: 2
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
bakeAxisConversion: 1
|
||||
preserveHierarchy: 0
|
||||
skinWeightsMode: 0
|
||||
maxBonesPerVertex: 4
|
||||
minBoneWeight: 0.001
|
||||
optimizeBones: 1
|
||||
meshOptimizationFlags: -1
|
||||
indexFormat: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVMarginMethod: 1
|
||||
secondaryUVMinLightmapResolution: 40
|
||||
secondaryUVMinObjectScale: 1
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
strictVertexDataChecks: 0
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||
blendShapeNormalImportMode: 1
|
||||
normalSmoothingSource: 0
|
||||
referencedClips: []
|
||||
importAnimation: 1
|
||||
humanDescription:
|
||||
serializedVersion: 3
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
globalScale: 1
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
autoGenerateAvatarMappingIfUnspecified: 1
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
avatarSetup: 0
|
||||
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||
importBlendShapeDeformPercent: 1
|
||||
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Materials/JusticeScale/Demo/Scripts.meta
Normal file
8
Assets/Materials/JusticeScale/Demo/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a93b6b6ec1eaa43448ec1518ee9b3948
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Materials/JusticeScale/Demo/Scripts/ClickAndClone.cs
Normal file
35
Assets/Materials/JusticeScale/Demo/Scripts/ClickAndClone.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace JusticeScale.Demo.Scripts
|
||||
{
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class ClickAndClone : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject prefabToClone;
|
||||
[SerializeField] private float customMass;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
GetComponent<Collider>().isTrigger = true;
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if (prefabToClone == null) return;
|
||||
|
||||
var clone = Instantiate(prefabToClone, transform.position, transform.rotation);
|
||||
|
||||
var dragScript = clone.GetComponent<DragAndDrop>();
|
||||
clone.GetComponent<Rigidbody>().mass = customMass;
|
||||
clone.transform.localScale = transform.lossyScale;
|
||||
clone.layer = gameObject.layer;
|
||||
|
||||
if (dragScript != null)
|
||||
{
|
||||
dragScript.isDragging = true;
|
||||
dragScript.StartDrag();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 601e2d9933b5441c806242732c65e8d5
|
||||
timeCreated: 1730344731
|
||||
12
Assets/Materials/JusticeScale/Demo/Scripts/DestroyObjects.cs
Normal file
12
Assets/Materials/JusticeScale/Demo/Scripts/DestroyObjects.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace JusticeScale.Demo.Scripts
|
||||
{
|
||||
public class DestroyObjects : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
Destroy(other.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aada9d88d1d9ad34bb4210ccaf7a0950
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
84
Assets/Materials/JusticeScale/Demo/Scripts/DragAndDrop.cs
Normal file
84
Assets/Materials/JusticeScale/Demo/Scripts/DragAndDrop.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using JusticeScale.Scripts;
|
||||
using UnityEngine;
|
||||
|
||||
namespace JusticeScale.Demo.Scripts
|
||||
{
|
||||
[RequireComponent(typeof(Rigidbody)),RequireComponent(typeof(Collider))]
|
||||
public class DragAndDrop : MonoBehaviour
|
||||
{
|
||||
private Vector3 _mousePosition, _mouseCameraPos, _initialPosition;
|
||||
private Transform _scaleTransform;
|
||||
|
||||
private Rigidbody _objectRigidbody;
|
||||
private float _lerpPosition;
|
||||
|
||||
[HideInInspector] public bool isDragging;
|
||||
private Camera _camera;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_camera = Camera.main;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_objectRigidbody = GetComponent<Rigidbody>();
|
||||
_scaleTransform = FindAnyObjectByType<ScaleController>().transform;
|
||||
}
|
||||
|
||||
private Vector3 GetMousePos()
|
||||
{
|
||||
return Camera.main != null ? Camera.main.WorldToScreenPoint(transform.position) : Vector3.zero;
|
||||
}
|
||||
|
||||
public void StartDrag()
|
||||
{
|
||||
if (_objectRigidbody == null) return;
|
||||
|
||||
_objectRigidbody.useGravity = false;
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
_objectRigidbody.linearVelocity = Vector3.zero;
|
||||
#else
|
||||
_objectRigidbody.velocity = Vector3.zero;
|
||||
#endif
|
||||
|
||||
_initialPosition = transform.position;
|
||||
_mousePosition = Input.mousePosition - GetMousePos();
|
||||
isDragging = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isDragging && _camera)
|
||||
{
|
||||
_objectRigidbody.angularVelocity = Vector3.zero;
|
||||
_mouseCameraPos = _camera.ScreenToWorldPoint(Input.mousePosition - _mousePosition);
|
||||
|
||||
_lerpPosition = Mathf.InverseLerp(_initialPosition.x, _scaleTransform.position.x, _mouseCameraPos.x);
|
||||
|
||||
if (Mathf.Approximately(_lerpPosition, 1)) _initialPosition = _scaleTransform.transform.position;
|
||||
|
||||
transform.position = new Vector3(
|
||||
_mouseCameraPos.x,
|
||||
_mouseCameraPos.y,
|
||||
Mathf.Lerp(_initialPosition.z, _scaleTransform.position.z, _lerpPosition));
|
||||
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
EndDrag();
|
||||
}
|
||||
}
|
||||
|
||||
private void EndDrag()
|
||||
{
|
||||
if (!_objectRigidbody) return;
|
||||
|
||||
isDragging = false;
|
||||
_objectRigidbody.useGravity = true;
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
StartDrag();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f45618ea93ba6c44bba244f917e13c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/Materials/JusticeScale/Demo/Scripts/SliderWeight.cs
Normal file
19
Assets/Materials/JusticeScale/Demo/Scripts/SliderWeight.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using JusticeScale.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace JusticeScale.Demo.Scripts
|
||||
{
|
||||
public class SliderWeight : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ScaleController scaleController;
|
||||
[SerializeField] private Text weightText;
|
||||
|
||||
|
||||
public void SetWeightValue(float value)
|
||||
{
|
||||
scaleController.maxWeightDifference = value;
|
||||
weightText.text = $"Max weight difference between scales set to {(int)value} kg";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1aec17a504e99c4e9df01b69c23e2aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user