mirror of
https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git
synced 2025-01-22 07:08:51 -05:00
Added Ball Attraction force trigger to hole
This commit is contained in:
parent
ab04b76de0
commit
a237c2efb1
File diff suppressed because it is too large
Load Diff
@ -4775,7 +4775,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 8649987843805268783, guid: 67b92308c184e4945a702caf44784747,
|
- target: {fileID: 8649987843805268783, guid: 67b92308c184e4945a702caf44784747,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 0.011796951
|
value: 0.0062
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8649987843805268783, guid: 67b92308c184e4945a702caf44784747,
|
- target: {fileID: 8649987843805268783, guid: 67b92308c184e4945a702caf44784747,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
@ -87,6 +87,75 @@ MonoBehaviour:
|
|||||||
m_Bits: 1
|
m_Bits: 1
|
||||||
tagsMask:
|
tagsMask:
|
||||||
- {fileID: 11400000, guid: 1f557d488f8464000b778362139a0045, type: 2}
|
- {fileID: 11400000, guid: 1f557d488f8464000b778362139a0045, type: 2}
|
||||||
|
--- !u!1 &4492872520714464466
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5490686123428067723}
|
||||||
|
- component: {fileID: 7767726477105542182}
|
||||||
|
- component: {fileID: 1127375846303195088}
|
||||||
|
m_Layer: 7
|
||||||
|
m_Name: BallForce
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5490686123428067723
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4492872520714464466}
|
||||||
|
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_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8649987843805268783}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!135 &7767726477105542182
|
||||||
|
SphereCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4492872520714464466}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_Radius: 2
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1127375846303195088
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4492872520714464466}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f7ac694396f0c4f9094eebbbd7c000d5, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
forceMultiplier: 1.5
|
||||||
|
tagsMask:
|
||||||
|
- {fileID: 11400000, guid: 1f557d488f8464000b778362139a0045, type: 2}
|
||||||
--- !u!1 &6121683813469744371
|
--- !u!1 &6121683813469744371
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -120,6 +189,7 @@ Transform:
|
|||||||
- {fileID: 84093497478952920}
|
- {fileID: 84093497478952920}
|
||||||
- {fileID: 6595505223521729305}
|
- {fileID: 6595505223521729305}
|
||||||
- {fileID: 7492627932365574004}
|
- {fileID: 7492627932365574004}
|
||||||
|
- {fileID: 5490686123428067723}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &6783148664893773472
|
--- !u!1 &6783148664893773472
|
||||||
@ -241,7 +311,7 @@ Transform:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 1.110223e-17, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: 1.110223e-17, 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: 2, y: 2, z: 2}
|
m_LocalScale: {x: 2.805009, y: 2.805009, z: 2.805009}
|
||||||
m_ConstrainProportionsScale: 1
|
m_ConstrainProportionsScale: 1
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 8649987843805268783}
|
m_Father: {fileID: 8649987843805268783}
|
||||||
|
34
Assets/Scripts/OnTriggerForce.cs
Normal file
34
Assets/Scripts/OnTriggerForce.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityAtoms.BaseAtoms;
|
||||||
|
using UnityAtoms.Tags;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MAVRIC.GEEKCup
|
||||||
|
{
|
||||||
|
public class OnTriggerForce : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float forceMultiplier = 1f;
|
||||||
|
|
||||||
|
public List<StringConstant> tagsMask = new ();
|
||||||
|
|
||||||
|
private void OnTriggerStay(Collider other)
|
||||||
|
{
|
||||||
|
if (!other.gameObject.HasAnyTag(tagsMask)) return;
|
||||||
|
|
||||||
|
var rb = other.attachedRigidbody;
|
||||||
|
|
||||||
|
if (rb == null) return;
|
||||||
|
|
||||||
|
// Calculate direction from object to transform
|
||||||
|
Vector3 direction = transform.position - rb.position;
|
||||||
|
|
||||||
|
// Normalize the direction to get a unit vector
|
||||||
|
direction.Normalize();
|
||||||
|
|
||||||
|
// Apply attractive force based on direction and attractForce
|
||||||
|
rb.AddForce(direction * forceMultiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/OnTriggerForce.cs.meta
Normal file
11
Assets/Scripts/OnTriggerForce.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f7ac694396f0c4f9094eebbbd7c000d5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -58,7 +58,7 @@ PlayerSettings:
|
|||||||
iosShowActivityIndicatorOnLoading: -1
|
iosShowActivityIndicatorOnLoading: -1
|
||||||
androidShowActivityIndicatorOnLoading: -1
|
androidShowActivityIndicatorOnLoading: -1
|
||||||
iosUseCustomAppBackgroundBehavior: 0
|
iosUseCustomAppBackgroundBehavior: 0
|
||||||
allowedAutorotateToPortrait: 0
|
allowedAutorotateToPortrait: 1
|
||||||
allowedAutorotateToPortraitUpsideDown: 0
|
allowedAutorotateToPortraitUpsideDown: 0
|
||||||
allowedAutorotateToLandscapeRight: 1
|
allowedAutorotateToLandscapeRight: 1
|
||||||
allowedAutorotateToLandscapeLeft: 1
|
allowedAutorotateToLandscapeLeft: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user