1
0
mirror of https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git synced 2025-01-21 22:58:50 -05:00

Colider work

This commit is contained in:
Ktaylor 2024-04-24 10:36:08 -04:00
parent 8ecd1e87b2
commit 8df3a21083
5 changed files with 238 additions and 59 deletions

View File

@ -13369,7 +13369,7 @@ PrefabInstance:
- target: {fileID: 4286995637743126827, guid: 8bb5b5825668a3a4d843e44289f40265,
type: 3}
propertyPath: axisOfMovement
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5852534905605273225, guid: 8bb5b5825668a3a4d843e44289f40265,
type: 3}
@ -13669,11 +13669,21 @@ PrefabInstance:
propertyPath: m_Name
value: Mavrik_Swinging_Axe
objectReference: {fileID: 0}
- target: {fileID: 7895031319030058801, guid: a0e1f1c1be235b5478c4a00cbd365f2d,
type: 3}
propertyPath: delay
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7895031319030058801, guid: a0e1f1c1be235b5478c4a00cbd365f2d,
type: 3}
propertyPath: speed
value: 2.6
objectReference: {fileID: 0}
- target: {fileID: 8656206106810088346, guid: a0e1f1c1be235b5478c4a00cbd365f2d,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8703011543340469622, guid: a0e1f1c1be235b5478c4a00cbd365f2d,
type: 3}
propertyPath: m_LocalPosition.y

View File

@ -7,7 +7,7 @@ public class MoveAndReturn : MonoBehaviour
private float distance = 5f; // Distance to move along the selected axis
[SerializeField]
private Axis axisOfMovement = Axis.X; // Axis of movement (default is X axis)
private Axis axisOfMovement = Axis.Right; // Axis of movement (default is X axis)
[SerializeField]
private float speed = 2f; // Speed of movement
@ -26,27 +26,27 @@ public class MoveAndReturn : MonoBehaviour
// Enumeration for the axis of movement
public enum Axis
{
X,
Y,
Z
Right,
Up,
Forward
}
private void Start()
{
// Save the starting position of the object
startingPosition = transform.localPosition;
startingPosition = transform.position;
// Calculate the target position based on the selected axis and distance
switch (axisOfMovement)
{
case Axis.X:
targetPosition = startingPosition + new Vector3(distance, 0, 0);
case Axis.Right:
targetPosition = startingPosition + (transform.right * distance); // new Vector3(distance, 0, 0);
break;
case Axis.Y:
targetPosition = startingPosition + new Vector3(0, distance, 0);
case Axis.Up:
targetPosition = startingPosition + (transform.up * distance); // new Vector3(0, distance, 0);
break;
case Axis.Z:
targetPosition = startingPosition + new Vector3(0, 0, distance);
case Axis.Forward:
targetPosition = startingPosition + (transform.forward * distance); // new Vector3(0, 0, distance);
break;
}
@ -60,19 +60,19 @@ public class MoveAndReturn : MonoBehaviour
// Move the object towards the target position
if (movingForward)
{
transform.localPosition = Vector3.MoveTowards(transform.localPosition, targetPosition, speed * Time.deltaTime);
transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);
// If the object reaches the target position, start moving back
if (transform.localPosition == targetPosition)
if (transform.position == targetPosition)
movingForward = false;
}
// Move the object back to the starting position
else
{
transform.localPosition = Vector3.MoveTowards(transform.localPosition, startingPosition, speed * Time.deltaTime);
transform.position = Vector3.MoveTowards(transform.position, startingPosition, speed * Time.deltaTime);
// If the object reaches the starting position, start moving forward again
if (transform.localPosition == startingPosition)
if (transform.position == startingPosition)
{
movingForward = true;
cyclesCompleted++;
@ -89,4 +89,4 @@ public class MoveAndReturn : MonoBehaviour
yield return null; // Wait for the next frame
}
}
}
}

View File

@ -111,8 +111,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c910448bdeecffe4e9acc471c8ef2f20, type: 3}
m_Name:
m_EditorClassIdentifier:
angle: 60
speed: 1
delay: 1
axis: {x: 0, y: 0, z: 1}
halfPendulum: 0
--- !u!4 &8703011543340469622 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 475890, guid: bbc2c53a30a8f5c4981c071296e51c5f,

View File

@ -3,9 +3,10 @@
--- !u!1 &149168
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 475890}
- component: {fileID: 3340184}
@ -21,30 +22,47 @@ GameObject:
m_IsActive: 1
--- !u!4 &475890
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 149168}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2780573314573648032}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3340184
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 149168}
m_Mesh: {fileID: 4300000, guid: c1de42800dba83442959031eacb99495, type: 3}
--- !u!23 &2337088
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 149168}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 42b64fdb315e3054ea757d8d1c4bcfa7, type: 2}
m_StaticBatchInfo:
@ -54,6 +72,7 @@ MeshRenderer:
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
@ -66,49 +85,102 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &3340184
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149168}
m_Mesh: {fileID: 4300000, guid: c1de42800dba83442959031eacb99495, type: 3}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 149168}
m_IsPrefabParent: 1
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &64509403232994950
MeshCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 149168}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
serializedVersion: 5
m_Convex: 1
m_CookingOptions: 14
m_SkinWidth: 0.01
m_CookingOptions: 30
m_Mesh: {fileID: 43666171727871236, guid: 1f23a948b9701e14f8283dd058acb335, type: 2}
--- !u!64 &64822207004734494
MeshCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 149168}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
serializedVersion: 5
m_Convex: 1
m_CookingOptions: 14
m_SkinWidth: 0.01
m_CookingOptions: 30
m_Mesh: {fileID: 43318415510654958, guid: 1f23a948b9701e14f8283dd058acb335, type: 2}
--- !u!1 &8747851545961597429
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2780573314573648032}
- component: {fileID: 4817125835886447843}
m_Layer: 0
m_Name: Colider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2780573314573648032
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8747851545961597429}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.05, y: 1.05, z: 1.05}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 475890}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &4817125835886447843
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8747851545961597429}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: 43318415510654958, guid: 1f23a948b9701e14f8283dd058acb335, type: 2}

View File

@ -1809,6 +1809,60 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8bb5b5825668a3a4d843e44289f40265, type: 3}
--- !u!1 &526003204
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 526003205}
- component: {fileID: 526003206}
m_Layer: 0
m_Name: Colider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &526003205
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 526003204}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.05, y: 1.05, z: 1.05}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 755149242}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &526003206
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 526003204}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: 43318415510654958, guid: 1f23a948b9701e14f8283dd058acb335, type: 2}
--- !u!1001 &536641696
PrefabInstance:
m_ObjectHideFlags: 0
@ -1981,6 +2035,12 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 735646270}
m_PrefabAsset: {fileID: 0}
--- !u!4 &755149242 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1209360984555405499, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
m_PrefabInstance: {fileID: 1000149159}
m_PrefabAsset: {fileID: 0}
--- !u!1 &765144257
GameObject:
m_ObjectHideFlags: 0
@ -3163,11 +3223,31 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 405047630416331516, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: delay
value: 0
objectReference: {fileID: 0}
- target: {fileID: 782634506160621956, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_Name
value: Control_Room
objectReference: {fileID: 0}
- target: {fileID: 1165778770825774287, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_Convex
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1165778770825774287, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1166089377725675095, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3277065184914629628, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_LocalPosition.x
@ -3223,6 +3303,16 @@ PrefabInstance:
propertyPath: m_Mesh
value:
objectReference: {fileID: 1934901309}
- target: {fileID: 6448227419044837256, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: axisOfMovement
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6770967778482584083, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8581408676546642477, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
propertyPath: m_Mesh
@ -3230,7 +3320,11 @@ PrefabInstance:
objectReference: {fileID: 1934901309}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 1209360984555405499, guid: 7fadbf24dc7c14173a60e008099ea15f,
type: 3}
insertIndex: -1
addedObject: {fileID: 526003205}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7fadbf24dc7c14173a60e008099ea15f, type: 3}
--- !u!1 &1028760414