environment ready!
This commit is contained in:
46
Assets/8_Scripts/2_General/ActuationsSine.cs
Normal file
46
Assets/8_Scripts/2_General/ActuationsSine.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cinemachine;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActuationsSine : MonoBehaviour
|
||||
{
|
||||
private Material m_ActuationsMaterial;
|
||||
public SkinnedMeshRenderer m_Material;
|
||||
public CinemachineVirtualCamera m_Camera;
|
||||
|
||||
public float m_CameraFOVMin;
|
||||
public float m_CameraFOVMax;
|
||||
|
||||
private float m_Sin = 0f;
|
||||
|
||||
public float m_SinValue = 0.1f;
|
||||
|
||||
private void Start(){
|
||||
m_ActuationsMaterial = m_Material.GetComponent<SkinnedMeshRenderer>().sharedMaterial;
|
||||
Debug.Log(m_ActuationsMaterial.name);
|
||||
}
|
||||
|
||||
private void Update(){
|
||||
m_Sin += m_SinValue;
|
||||
float sin = Mathf.Sin(m_Sin);
|
||||
|
||||
float mappedFOV = Map(m_CameraFOVMin, m_CameraFOVMax, -1, 1, sin);
|
||||
m_Camera.m_Lens.FieldOfView = mappedFOV;
|
||||
|
||||
|
||||
float mappedVertex = Map(50f, 10f, -1, 1, sin);
|
||||
m_ActuationsMaterial.SetFloat("Vector1_B2CC132F", mappedVertex);
|
||||
}
|
||||
|
||||
public float Map(float from, float to, float from2, float to2, float value){
|
||||
if(value <= from2){
|
||||
return from;
|
||||
}else if(value >= to2){
|
||||
return to;
|
||||
}else{
|
||||
return (to - from) * ((value - from2) / (to2 - from2)) + from;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/8_Scripts/2_General/ActuationsSine.cs.meta
generated
Normal file
11
Assets/8_Scripts/2_General/ActuationsSine.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f565245824f6d344b1f6510f0ff94e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/8_Scripts/2_General/LockTarget.cs
Normal file
28
Assets/8_Scripts/2_General/LockTarget.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LockTarget : MonoBehaviour
|
||||
{
|
||||
|
||||
public Transform m_Object;
|
||||
private Vector3 m_Position;
|
||||
private Quaternion m_Rotation;
|
||||
|
||||
private void OnEnable(){
|
||||
m_Position = m_Object.position;
|
||||
m_Rotation = m_Object.rotation;
|
||||
Debug.Log($"{m_Position} pos");
|
||||
}
|
||||
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
Vector3 newPosition = m_Object.position;
|
||||
Vector3 normPosition = new Vector3(newPosition.x, m_Position.y, newPosition.z);
|
||||
this.transform.position = normPosition;
|
||||
|
||||
Quaternion newRotation = m_Object.rotation;
|
||||
this.transform.rotation = new Quaternion(m_Rotation.x, newRotation.y, m_Rotation.z, m_Rotation.w);
|
||||
}
|
||||
}
|
||||
11
Assets/8_Scripts/2_General/LockTarget.cs.meta
generated
Normal file
11
Assets/8_Scripts/2_General/LockTarget.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c62f8ce80ff3a614081b38c92965d2e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user