Commit 565631c3 authored by Haobo38's avatar Haobo38
Browse files

portConfig

parent 63d43947
Pipeline #100842 failed with stage
in 1 minute and 4 seconds
......@@ -29,14 +29,14 @@ public class AttachTransformeWithForceGrab : MonoBehaviour
// transform.position = leftHandRayInteractor.interactablesSelected[1].transform.position;
if (hit.transform.gameObject.layer == 6)
{
Debug.Log("hitting a lifecycle " + transform.position);
// Debug.Log("hitting a lifecycle " + transform.position);
transform.eulerAngles = new Vector3(0,transform.eulerAngles.y,0);
}
else
{
transform.rotation = hit.transform.rotation;
Debug.Log("hitting a go with the position : " + transform.position);
// Debug.Log("hitting a go with the position : " + transform.position);
}
transform.position = rightHandController.transform.position;//+ rightHandController.transform.forward;
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewPortButtonPositionFix : MonoBehaviour
{
private Vector3 buttonPosition;
Bounds modelBounds;
float x, y, z;
void Start()
{
}
// Update is called once per frame
void Update()
{
modelBounds = transform.parent.parent.gameObject.GetComponent<Renderer>().bounds;
x = modelBounds.center.x - modelBounds.extents.x;
y = modelBounds.center.y - modelBounds.extents.y;
z = modelBounds.center.z;
transform.position = new Vector3(x, y, z);
}
}
fileFormatVersion: 2
guid: aeffce3c171720a4c90b2b8444f61fde
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PortButton : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 45bf08cf4d61922498c61c15a0181829
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PortManagement : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: c06feebcfe634b244917ea81d87e3caf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PortPrePositionFix : MonoBehaviour
{
private Vector3 modelColliderSize, portColliderSize;
private List<GameObject> Ports =new List<GameObject>();
private int portsNumber;
// Start is called before the first frame update
void Start()
{
portsNumber = transform.childCount;
for(int i = 0;i<portsNumber;++i)
{
Ports.Add(transform.GetChild(i).gameObject);
}
}
// Update is called once per frame
void Update()
{
modelColliderSize = transform.parent.parent.localScale;
foreach (GameObject port in Ports)
port.transform.localScale = modelColliderSize / 4;
// modelColliderSize = transform.parent.GetComponent<BoxCollider>().size;
portColliderSize = modelColliderSize / 4;
/*
Ports[0].transform.position = transform.parent.position + new Vector3(-(modelColliderSize.x / 2 ), -modelColliderSize.y / 5, 0);
Ports[1].transform.position = transform.parent.position + new Vector3(-(modelColliderSize.x / 2 ), modelColliderSize.y / 5, 0);
Ports[2].transform.position = transform.parent.position + new Vector3((modelColliderSize.x / 2 ), -modelColliderSize.y / 5, 0);
Ports[3].transform.position = transform.parent.position + new Vector3((modelColliderSize.x / 2 ), modelColliderSize.y / 5, 0);*/
Ports[0].transform.position = transform.parent.parent.position + new Vector3(-(modelColliderSize.x / 2 + portColliderSize.x / 2), -modelColliderSize.y / 5, 0);
Ports[1].transform.position = transform.parent.parent.position + new Vector3(-(modelColliderSize.x / 2 + portColliderSize.x / 2), modelColliderSize.y / 5, 0);
Ports[2].transform.position = transform.parent.parent.position + new Vector3((modelColliderSize.x / 2 + portColliderSize.x / 2), -modelColliderSize.y / 5, 0);
Ports[3].transform.position = transform.parent.parent.position + new Vector3((modelColliderSize.x / 2 + portColliderSize.x / 2), modelColliderSize.y / 5, 0);
}
}
fileFormatVersion: 2
guid: 5f1595e5c9a7d7042b43492a077b4cab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PortSizeAdjust : MonoBehaviour
{
private Vector3 portColliderSize;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
//portColliderSize = transform.parent.parent.localScale/4;
this.transform.localScale = transform.parent.parent.localScale / 4;
}
}
fileFormatVersion: 2
guid: b13686e0a6f37c94b8a1074e3b3532a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;
using System.Linq;
using InputDeviceXR = UnityEngine.XR.InputDevice;
public class ObjectMenuTesst : MonoBehaviour
{
[SerializeField]
private XRNode xrNode = XRNode.RightHand;
private List<InputDevice> devices = new List<InputDevice>();
private InputDevice device;
bool triggerButtonAction = false;
[SerializeField] XRRayInteractor rightHandRayInteractor = null;
private RaycastHit hit;
private Vector3 initialScale;
private bool menuOpen = false;
bool triggerButtonbeforeAction = false;
void GetDevice()
{
InputDevices.GetDevicesAtXRNode(xrNode, devices);
device = devices.FirstOrDefault();
}
void Start()
{
initialScale = transform.Find("Menu").transform.localScale;
transform.Find("Menu").transform.DOScale(0, 0);
// transform.Find("Menu").gameObject.SetActive(false);
}
private void Update()
{
if (!device.isValid)
{
Debug.Log("getdevice failed");
GetDevice();
}
}
private void LateUpdate()
{
rightHandRayInteractor.TryGetCurrent3DRaycastHit(out hit);
// Debug.Log(" menubuttondebug button trigger test ok ");
if (hit.transform != null)
{
device.TryGetFeatureValue(CommonUsages.triggerButton, out triggerButtonAction);
if (triggerButtonAction == true && triggerButtonbeforeAction == false)
{
if (device.TryGetFeatureValue(CommonUsages.triggerButton, out triggerButtonAction) && triggerButtonAction && menuOpen == false)
{
Debug.Log(" menubuttondebug button trigger test ok to open");
OpenObjectMenu();
}
else if (device.TryGetFeatureValue(CommonUsages.triggerButton, out triggerButtonAction) && triggerButtonAction && menuOpen == true)
{
CloseObjectMenu();
Debug.Log(" menubuttondebug button trigger test ok to close");
}
}
}
/*
if (hit.transform != null)
{
if (device.TryGetFeatureValue(CommonUsages.triggerButton, out triggerButtonAction) && hit.transform.gameObject == this.gameObject && !menuOpen)
OpenObjectMenu();
if (device.TryGetFeatureValue(CommonUsages.triggerButton, out triggerButtonAction) && hit.transform.gameObject == this.gameObject && menuOpen)
CloseObjectMenu();
}*/
triggerButtonbeforeAction = triggerButtonAction;
}
private void OpenObjectMenu()
{
transform.Find("Menu").transform.localScale = new Vector3(0, 0, 0);
//transform.Find("Menu").gameObject.SetActive(true);
transform.Find("Menu").transform.DOScale(initialScale, 0.5f);
menuOpen = true;
}
private void CloseObjectMenu()
{
transform.Find("Menu").transform.DOScale(0, 0.5f);
// transform.Find("Menu").gameObject.SetActive(false);
menuOpen = false;
}
}
fileFormatVersion: 2
guid: e5e0030602d62574fae80a2eb74be450
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -15,8 +15,8 @@ MonoBehaviour:
m_LayerNames:
- Default
- Lifecycle
- Models
-
- Model
- Port
-
-
-
......
......@@ -12,8 +12,8 @@ TagManager:
- Water
- UI
- LIfecycle
-
-
- Model
- Port
-
-
-
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment