Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 48 additions & 0 deletions Assets/FluxTension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FluxTension : MonoBehaviour
{
TypeQuark[] quarks;
[Tooltip("How elastic are flux tubes at pulling quarks together? (A constant)")] public float A = 1;
public float B = 1;
public float C = 1;
public float threshold = 1000;

public GameObject fluxCenter;

public float scale = 0.1f;

// Start is called before the first frame update
void Start()
{
quarks = gameObject.GetComponentsInChildren<TypeQuark>();
}

// Update is called once per frame
void Update()
{
foreach (TypeQuark quark in quarks) {
Vector3 totalForce = Vector3.zero;//getForce(quark.transform.position, transform.position) * 100;
totalForce += getForce(quark.transform.position, fluxCenter.transform.position);
if (float.IsNaN(totalForce.x) || float.IsNaN(totalForce.y) || float.IsNaN(totalForce.z)) //NaN Check
continue;
quark.GetComponent<Rigidbody>().AddForce(totalForce, ForceMode.Force); //Apply a force to each quark in the direction of the flux tube center
//fluxCenter.GetComponent<Rigidbody>().AddForce(-scale * totalForce, ForceMode.Force);
}
}

Vector3 getForce(Vector3 pos1, Vector3 pos2) {
Vector3 r = pos2 - pos1;
//F = Ar + Br^Cr
Vector3 force = ((A * r + (Mathf.Pow(B * r.magnitude, C * r.magnitude) * r.normalized)) * Time.deltaTime);

if (force.magnitude > threshold) {
force = force.normalized * threshold;
Debug.Log("Threshold reached!");
}

return force;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

260 changes: 204 additions & 56 deletions Assets/Fonts/Renogare-Regular SDF.asset

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Assets/InitialVel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InitialVel : MonoBehaviour
{
public Vector3 force;
// Start is called before the first frame update
void Start()
{
GetComponent<Rigidbody>().AddForce(force, ForceMode.Impulse);
}
}
11 changes: 11 additions & 0 deletions Assets/InitialVel.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Assets/LockOn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LockOn : MonoBehaviour
{
public Transform interest;
Vector3 offset;
[Tooltip("How snappy is the camera?")]public float speed = 20;

private void Start()
{
if (interest) offset = transform.position - interest.position;
}

void Update()
{
if (interest) transform.position = Vector3.Lerp(transform.position, interest.position + offset, Time.fixedDeltaTime * speed);
}
}
11 changes: 11 additions & 0 deletions Assets/LockOn.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions Assets/Materials/Electric Field.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Electric Field
m_Shader: {fileID: -6465566751694194690, guid: a877d100dfbcdac4fb28af0a8eb9341f, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Vector1_76634227db204b76af2d91e61eac5e6b: -3
m_Colors:
- Color_6f92dc3ff16947f5817b5cb574051c92: {r: 0, g: 1, b: 0.98988575, a: 0}
m_BuildTextureStacks: []
8 changes: 8 additions & 0 deletions Assets/Materials/Electric Field.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions Assets/Materials/Magentic Field.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Magentic Field
m_Shader: {fileID: -6465566751694194690, guid: a877d100dfbcdac4fb28af0a8eb9341f, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Vector1_76634227db204b76af2d91e61eac5e6b: -3
m_Colors:
- Color_6f92dc3ff16947f5817b5cb574051c92: {r: 1, g: 0.5686732, b: 0, a: 0}
m_BuildTextureStacks: []
8 changes: 8 additions & 0 deletions Assets/Materials/Magentic Field.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading