generated from VR-Sexe/Unity3DTemplate
Fixing MovableFurniture
This commit is contained in:
parent
e3858311d7
commit
6c93237640
@ -25,8 +25,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1253093426770874476}
|
m_GameObject: {fileID: 1253093426770874476}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 7.4677825, y: 6.87, z: -3.75}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 0.94424, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 3674349604157782260}
|
m_Father: {fileID: 3674349604157782260}
|
||||||
@ -72,8 +72,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2048859290140646716}
|
m_GameObject: {fileID: 2048859290140646716}
|
||||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: -2.4077811, y: 0, z: 0}
|
m_LocalPosition: {x: 5.0600014, y: 6.87, z: -3.75}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 0.94424, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 3674349604157782260}
|
m_Father: {fileID: 3674349604157782260}
|
||||||
@ -167,9 +167,9 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 4158574887593288270}
|
m_GameObject: {fileID: 4158574887593288270}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 3.2372222, y: 1.7355555, z: -6.6777782}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 0.12, y: 0.11999999, z: 0.11999999}
|
m_LocalScale: {x: 0.12, y: 0.10616519, z: 0.11999999}
|
||||||
m_ConstrainProportionsScale: 1
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7846351332623750186}
|
- {fileID: 7846351332623750186}
|
||||||
- {fileID: 705425444331171642}
|
- {fileID: 705425444331171642}
|
||||||
@ -220,8 +220,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 6146061087085142095}
|
m_GameObject: {fileID: 6146061087085142095}
|
||||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: -2.4077811, y: 0, z: 0}
|
m_LocalPosition: {x: 5.06, y: 6.87, z: -3.75}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 0.94424, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 3674349604157782260}
|
m_Father: {fileID: 3674349604157782260}
|
||||||
|
|||||||
@ -161,6 +161,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: chair
|
value: chair
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 919132149155446097, guid: 61dd8047e5e66dc4db5c150abe38beae, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 61dd8047e5e66dc4db5c150abe38beae, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 61dd8047e5e66dc4db5c150abe38beae, type: 3}
|
||||||
--- !u!1 &749501648960564542 stripped
|
--- !u!1 &749501648960564542 stripped
|
||||||
|
|||||||
@ -24,15 +24,15 @@ Transform:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2835658414891243653}
|
m_GameObject: {fileID: 2835658414891243653}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: -0.7193398, y: 0, z: 0, w: 0.69465846}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 0.06708567, y: 0.06708567, z: 0.06708567}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 6063464173187445548}
|
- {fileID: 6063464173187445548}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: -92, y: 0, z: 0}
|
||||||
--- !u!114 &6811449984730649892
|
--- !u!114 &6811449984730649892
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -60,37 +60,49 @@ PrefabInstance:
|
|||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
|
propertyPath: m_LocalScale.x
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
|
propertyPath: m_LocalScale.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
|
propertyPath: m_LocalScale.z
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -0.99781084
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 5.660246
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -26.505024
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.69465846
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.7193398
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: -0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: -0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
value: -92
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
|||||||
@ -27,6 +27,7 @@ Transform:
|
|||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 3302308642418619131}
|
m_Father: {fileID: 3302308642418619131}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -56,73 +57,59 @@ PrefabInstance:
|
|||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 260494349833344412, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 260494349833344412, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: OVRHmd
|
value: OVRHmd
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: -0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: -0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2283902713005402673, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 2283902713005402673, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: _updateAfter
|
propertyPath: _updateAfter
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 7429438080402074591}
|
objectReference: {fileID: 7429438080402074591}
|
||||||
- target: {fileID: 2283902713005402673, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
- target: {fileID: 2283902713005402673, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
propertyPath: _iModifyDataFromSourceMono
|
propertyPath: _iModifyDataFromSourceMono
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 7429438080402074591}
|
objectReference: {fileID: 7429438080402074591}
|
||||||
@ -130,7 +117,6 @@ PrefabInstance:
|
|||||||
m_SourcePrefab: {fileID: 100100000, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
--- !u!4 &3302308642418619131 stripped
|
--- !u!4 &3302308642418619131 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531,
|
m_CorrespondingSourceObject: {fileID: 1397600019941919615, guid: 982ea7c9970bf124bb5535f9df2f9531, type: 3}
|
||||||
type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 4517512739943872900}
|
m_PrefabInstance: {fileID: 4517512739943872900}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
Assets/Scenes/FabLab/FabLab/ReflectionProbe-0.png
(Stored with Git LFS)
BIN
Assets/Scenes/FabLab/FabLab/ReflectionProbe-0.png
(Stored with Git LFS)
Binary file not shown.
@ -12,6 +12,8 @@ public class FurnitureMover : MonoBehaviour
|
|||||||
public SteamVR_Behaviour_Pose pose;
|
public SteamVR_Behaviour_Pose pose;
|
||||||
public SteamVR_Action_Boolean interactWithUI = SteamVR_Input.GetBooleanAction("InteractUI");
|
public SteamVR_Action_Boolean interactWithUI = SteamVR_Input.GetBooleanAction("InteractUI");
|
||||||
|
|
||||||
|
public LayerMask AutoPlacementEnvironmentMask;
|
||||||
|
|
||||||
public GameObject pointer;
|
public GameObject pointer;
|
||||||
private MovableFurniture Grabbing;
|
private MovableFurniture Grabbing;
|
||||||
|
|
||||||
@ -54,6 +56,19 @@ public class FurnitureMover : MonoBehaviour
|
|||||||
Ray raycast = new Ray(transform.position, transform.forward);
|
Ray raycast = new Ray(transform.position, transform.forward);
|
||||||
RaycastHit hit;
|
RaycastHit hit;
|
||||||
bool bHit = Physics.Raycast(raycast, out hit);
|
bool bHit = Physics.Raycast(raycast, out hit);
|
||||||
|
|
||||||
|
|
||||||
|
Ray SnapRaycast = new Ray(transform.position, transform.forward);
|
||||||
|
RaycastHit SnapHit;
|
||||||
|
bool SnapbHit = Physics.Raycast(SnapRaycast, out SnapHit, 100f, AutoPlacementEnvironmentMask);
|
||||||
|
|
||||||
|
if (SnapbHit && Grabbing != null)
|
||||||
|
{
|
||||||
|
Grabbing.SnapTo(SnapHit.point, AutoPlacementEnvironmentMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (previousContact && previousContact != hit.transform)
|
if (previousContact && previousContact != hit.transform)
|
||||||
{
|
{
|
||||||
PointerEventArgs args = new PointerEventArgs();
|
PointerEventArgs args = new PointerEventArgs();
|
||||||
@ -122,21 +137,15 @@ public class FurnitureMover : MonoBehaviour
|
|||||||
}
|
}
|
||||||
clickHandler.OnPointerClickDown();
|
clickHandler.OnPointerClickDown();
|
||||||
Grabbing = clickHandler.parent;
|
Grabbing = clickHandler.parent;
|
||||||
Grabbing.transform.SetParent(this.transform);
|
/*Grabbing.transform.SetParent(this.transform);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPointerClickUp(object sender, PointerEventArgs e)
|
private void OnPointerClickUp(object sender, PointerEventArgs e)
|
||||||
{
|
{
|
||||||
/*MovableFurniturePart clickHandler = e.target.GetComponent<MovableFurniturePart>();
|
|
||||||
if (clickHandler == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clickHandler.OnPointerClickDown();*/
|
|
||||||
if(Grabbing != null)
|
if(Grabbing != null)
|
||||||
{
|
{
|
||||||
Grabbing.OnPointerClickUp();
|
Grabbing.OnPointerClickUp();
|
||||||
Grabbing.transform.SetParent(this.transform.root);
|
/*Grabbing.transform.SetParent(this.transform.root);*/
|
||||||
Grabbing = null;
|
Grabbing = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using Oculus.Interaction.PoseDetection;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -10,6 +11,9 @@ public class MovableFurniture : MonoBehaviour
|
|||||||
private List<Transform> children;
|
private List<Transform> children;
|
||||||
private List<ObjectOutline> outlines;
|
private List<ObjectOutline> outlines;
|
||||||
private Rigidbody _rigidbody;
|
private Rigidbody _rigidbody;
|
||||||
|
|
||||||
|
private Bounds combinedBounds;
|
||||||
|
private Vector3 centerOffset;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@ -27,6 +31,7 @@ public class MovableFurniture : MonoBehaviour
|
|||||||
outline.OutlineWidth = 5f;
|
outline.OutlineWidth = 5f;
|
||||||
outline.enabled = false;
|
outline.enabled = false;
|
||||||
}
|
}
|
||||||
|
CalculateBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -70,4 +75,74 @@ public class MovableFurniture : MonoBehaviour
|
|||||||
outline.enabled = false;
|
outline.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SnapTo(Vector3 position, LayerMask layerMask)
|
||||||
|
{
|
||||||
|
Vector3 displacement = Vector3.zero;
|
||||||
|
this.transform.position = position+centerOffset;
|
||||||
|
Vector3[] directions = { Vector3.right, Vector3.left, Vector3.up, Vector3.down, Vector3.forward, Vector3.back };
|
||||||
|
int[] extents = { 0,0,1,1,2,2 };
|
||||||
|
|
||||||
|
for (int i = 0; i<6; i++ )
|
||||||
|
{
|
||||||
|
Ray raycast = new Ray(transform.position - centerOffset - (directions[i] * combinedBounds.extents[extents[i]]), (directions[i] * combinedBounds.size[extents[i]]));
|
||||||
|
RaycastHit hit;
|
||||||
|
bool SnapbHit = Physics.Raycast(raycast, out hit, combinedBounds.size[extents[i]], layerMask);
|
||||||
|
if (SnapbHit)
|
||||||
|
{
|
||||||
|
displacement[i / 2] -= (i % 2 == 1 ? -1 : 1) * (combinedBounds.size[extents[i]] - (hit.distance));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Ray raycast = new Ray((transform.position - centerOffset) - (new Vector3(0, 0, combinedBounds.extents.z)), (new Vector3(0, 0, combinedBounds.size.z )));
|
||||||
|
RaycastHit hit;
|
||||||
|
bool SnapbHit = Physics.Raycast(raycast, out hit, combinedBounds.size.z, layerMask);
|
||||||
|
if (SnapbHit)
|
||||||
|
{
|
||||||
|
Debug.Log("Hit");
|
||||||
|
//displacement.z -= (0 % 2 == 1 ? -1 : 1) * (2*combinedBounds.size.z - (hit.distance));
|
||||||
|
displacement.z -= (combinedBounds.size.z - (hit.distance));
|
||||||
|
}*/
|
||||||
|
Debug.Log(displacement);
|
||||||
|
this.transform.Translate(displacement, Space.World);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OnDrawGizmos()
|
||||||
|
{
|
||||||
|
// Draw a yellow sphere at the transform's position
|
||||||
|
Gizmos.color = Color.red;
|
||||||
|
Gizmos.DrawWireCube(transform.position - centerOffset, combinedBounds.size);
|
||||||
|
Gizmos.DrawRay((transform.position - centerOffset) - (new Vector3(0,0,combinedBounds.extents.z)), (new Vector3(0, 0, combinedBounds.size.z)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalculateBounds()
|
||||||
|
{
|
||||||
|
if (GetComponent<Renderer>() != null)
|
||||||
|
{
|
||||||
|
combinedBounds = GetComponent<Renderer>().bounds;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
combinedBounds = new Bounds(transform.position, Vector3.zero);
|
||||||
|
}
|
||||||
|
var renderers = GetComponentsInChildren<Collider>();
|
||||||
|
foreach (Collider child in renderers)
|
||||||
|
{
|
||||||
|
if (child != GetComponent<Renderer>())
|
||||||
|
{
|
||||||
|
if (combinedBounds == null)
|
||||||
|
{
|
||||||
|
combinedBounds = child.bounds;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
combinedBounds.Encapsulate(child.bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//combinedBounds = renderers[0].bounds;
|
||||||
|
Debug.Log(combinedBounds.center);
|
||||||
|
centerOffset = transform.position - combinedBounds.center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,6 +93,11 @@
|
|||||||
"key": "mesh.meshColliderIsConvex",
|
"key": "mesh.meshColliderIsConvex",
|
||||||
"value": "{\"m_Value\":false}"
|
"value": "{\"m_Value\":false}"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
|
"key": "SelectEdgeLoop.selectIterative",
|
||||||
|
"value": "{\"m_Value\":false}"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "UnityEngine.ProBuilder.RectSelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
"type": "UnityEngine.ProBuilder.RectSelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "editor.dragSelectRectMode",
|
"key": "editor.dragSelectRectMode",
|
||||||
@ -111,7 +116,7 @@
|
|||||||
{
|
{
|
||||||
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "editor.lastMeshSelectMode",
|
"key": "editor.lastMeshSelectMode",
|
||||||
"value": "{\"m_Value\":8}"
|
"value": "{\"m_Value\":4}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user