Fix pivot points for furniture

This commit is contained in:
Legonzaur 2023-01-23 15:58:22 +01:00
parent 5657cc14d5
commit a458ca5f57
9 changed files with 57 additions and 43 deletions

View File

@ -27,7 +27,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 999207089627997314}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0.039, z: -0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -122,7 +122,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5022219494863929666}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.2239313, y: 1.046101, z: -0.024066806}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -146,6 +146,7 @@ MonoBehaviour:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
wallMount: 0
--- !u!1 &8294151951189356629
GameObject:
m_ObjectHideFlags: 0
@ -173,7 +174,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8294151951189356629}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0.039, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []

View File

@ -25,7 +25,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6502689968648656832}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.9697971, y: 1.0193512, z: -1.9544978}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_ConstrainProportionsScale: 1
m_Children:
@ -48,6 +48,7 @@ MonoBehaviour:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
wallMount: 0
--- !u!1001 &743310008199716879
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -72,8 +72,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2048859290140646716}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 5.0600014, y: 6.87, z: -3.75}
m_LocalScale: {x: 1, y: 0.94424, z: 1}
m_LocalPosition: {x: 5.0600014, y: 6.87, z: -3.9438}
m_LocalScale: {x: 1, y: 0.94424, z: 1.0554}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3674349604157782260}
@ -189,6 +189,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7310167259df75745b825087bf4c8de0, type: 3}
m_Name:
m_EditorClassIdentifier:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
wallMount: 0
--- !u!1 &6146061087085142095
GameObject:
m_ObjectHideFlags: 0

View File

@ -24,7 +24,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699182198977620406}
m_LocalRotation: {x: -0, y: -0, z: 0.70710576, w: 0.70710784}
m_LocalPosition: {x: -0.51733893, y: 1.621, z: -1.4194237}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -58,7 +58,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5078885061494400643}
m_LocalRotation: {x: -0.00000005960465, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.62495, z: -0.25492}
m_LocalPosition: {x: 0.168, y: 0.113, z: -0.229}
m_LocalScale: {x: -0.16656025, y: -0.16656025, z: -0.16656025}
m_ConstrainProportionsScale: 0
m_Children: []

View File

@ -86,7 +86,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: -1.36
objectReference: {fileID: 0}
- target: {fileID: 4313268324301600403, guid: 5035aafbde1dd40458b242f88962c3d3, type: 3}
propertyPath: m_LocalRotation.w

View File

@ -24,14 +24,14 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 726151543146820464}
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalPosition: {x: 2.6100001, y: 1.8444445, z: -0.12111112}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.11111112, y: 0.11111112, z: 0.11111112}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 726151543547972459}
- {fileID: 726151544272545065}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1 &726151543547972456
GameObject:
@ -59,7 +59,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 726151543547972456}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalPosition: {x: 2.73, y: 7.08, z: -3.48}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -142,7 +142,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 726151544272545062}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalPosition: {x: 2.73, y: 7.08, z: -3.48}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []

View File

@ -2392,26 +2392,26 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1705480523}
- {fileID: 808552922}
- {fileID: 1329833008}
- {fileID: 260182308}
- {fileID: 765875807}
- {fileID: 1290121936}
- {fileID: 1527984575637916538}
- {fileID: 1705480523}
- {fileID: 808552922}
- {fileID: 146814758}
- {fileID: 896101879}
- {fileID: 1455652491}
- {fileID: 1672585692}
- {fileID: 435302310}
- {fileID: 336078038}
- {fileID: 1173886246}
- {fileID: 1821824934}
- {fileID: 293073269}
- {fileID: 1782748918}
- {fileID: 336078038}
- {fileID: 60326086}
- {fileID: 670219875}
- {fileID: 373875250}
- {fileID: 1173886246}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -6516,7 +6516,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.123
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -6912,7 +6912,7 @@ Transform:
m_Children:
- {fileID: 936418819}
m_Father: {fileID: 45957245}
m_RootOrder: 15
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &360260901
PrefabInstance:
@ -11842,7 +11842,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.119
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -13405,7 +13405,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.12299919
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -15012,7 +15012,7 @@ Transform:
- {fileID: 2128333932}
- {fileID: 197140882}
m_Father: {fileID: 45957245}
m_RootOrder: 6
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &815680570
PrefabInstance:
@ -15114,7 +15114,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.11899948
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -16555,7 +16555,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.11899948
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -17592,7 +17592,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.12299919
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -18672,7 +18672,7 @@ Transform:
- {fileID: 804182423}
- {fileID: 1043384080}
m_Father: {fileID: 45957245}
m_RootOrder: 19
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1180503447
PrefabInstance:
@ -23752,7 +23752,7 @@ Transform:
- {fileID: 1695254331}
- {fileID: 1180503448}
m_Father: {fileID: 45957245}
m_RootOrder: 5
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1727196003
PrefabInstance:
@ -23787,7 +23787,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.11899948
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w
@ -28128,7 +28128,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalPosition.z
value: 0.04261017
value: 0.12299919
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalRotation.w

View File

@ -1,6 +1,4 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using Valve.VR;
using Valve.VR.Extras;
using Valve.VR.InteractionSystem;
@ -85,7 +83,7 @@ public class FurnitureMover : MonoBehaviour
{
Grabbing.SnapTo(SnapHit.point, AutoPlacementEnvironmentMask, transform.forward);
}
if (previousContact && previousContact != hit.transform)
{
PointerEventArgs args = new PointerEventArgs();
@ -145,12 +143,9 @@ public class FurnitureMover : MonoBehaviour
}
pointer.transform.localPosition = new Vector3(0f, 0f, dist / 2f);
if(Grabbing != null && snapLeftAction != null && snapRightAction != null && snapLeftAction.activeBinding && snapRightAction.activeBinding)
//Rotate Logic
if (Grabbing != null && snapLeftAction != null && snapRightAction != null && snapLeftAction.activeBinding && snapRightAction.activeBinding)
{
bool leftHandTurnLeft = snapLeftAction.GetStateDown(hand.handType);
bool rightHandTurnLeft = snapLeftAction.GetStateDown(hand.otherHand.handType);
@ -198,7 +193,7 @@ public class FurnitureMover : MonoBehaviour
GrabFurniture(Grabbing.gameObject);
/*Grabbing.transform.SetParent(this.transform);*/
}
public void SetGrabbing(MovableFurniture furniture)
{
Grabbing = furniture;
@ -234,13 +229,13 @@ public class FurnitureMover : MonoBehaviour
private void OnPointerIn(object sender, PointerEventArgs e)
{
if (Grabbing != null) return;
MovableFurniturePart pointerEnterHandler = e.target.GetComponent<MovableFurniturePart>();
if (pointerEnterHandler == null)
{
return;
}
pointerEnterHandler.OnPointerEnter();
}
}

View File

@ -96,6 +96,9 @@ public class MovableFurniture : Furniture
{
Vector3 previousPosition = transform.position;
Vector3 offset = Vector3.zero;
transform.position = position;
return;
if (wallMount)
{
transform.position = position;
@ -149,21 +152,31 @@ public class MovableFurniture : Furniture
void OnDrawGizmos()
{
// Draw a yellow sphere at the transform's position
Gizmos.color = Color.red;
/*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)));
Gizmos.DrawRay((transform.position - centerOffset) - (new Vector3(0, 0, combinedBounds.extents.z)), (new Vector3(0, 0, combinedBounds.size.z)));*/
}
private void OnDisable()
{
if(outlines != null && outlines.Count > 0)
if (outlines != null && outlines.Count > 0)
{
foreach (ObjectOutline outline in outlines)
{
outline.enabled = false;
}
}
}
private void OnCollisionEnter(Collision collision)
{
Debug.Log("collisionEnter");
}
private void OnCollisionExit(Collision collision)
{
Debug.Log("collisionExit");
}
}