Merge branch 'Shumpei' into portals-and-body
# Conflicts: # Assets/LowPolyDungeons/LowPolyDungeons_HDRP_2018.4.unitypackage.meta # Assets/LowPolyDungeons/LowPolyDungeons_LWRP_2018.4.unitypackage.meta # Assets/LowPolyDungeons/LowPolyDungeons_URP_2019.3.unitypackage.meta # Assets/Project Files/Scripts/Shumpei.meta # Assets/SimpleNaturePack/SimpleNaturePack_HDRP_2018.4.unitypackage.meta
This commit is contained in:
12
Assets/Project Files/Scripts/Shumpei.meta
Normal file
12
Assets/Project Files/Scripts/Shumpei.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
<<<<<<< HEAD:Assets/LowPolyDungeons/LowPolyDungeons_HDRP_2018.4.unitypackage.meta
|
||||
guid: c9f42f34fc0706c499aa448484f3db62
|
||||
=======
|
||||
guid: 20b2cd43130816e429a419c3adf589b0
|
||||
folderAsset: yes
|
||||
>>>>>>> Shumpei:Assets/Project Files/Scripts/Shumpei.meta
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/Project Files/Scripts/Shumpei/ArmSwingLocomotion.cs
Normal file
64
Assets/Project Files/Scripts/Shumpei/ArmSwingLocomotion.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ArmSwingLocomotion : MonoBehaviour
|
||||
{
|
||||
public GameObject LeftHand;
|
||||
public GameObject RightHand;
|
||||
public GameObject CenterEyeCamera;
|
||||
public GameObject ForwardDirection;
|
||||
|
||||
private Vector3 PositionPreviousFrameLeftHand;
|
||||
private Vector3 PositionPreviousFrameRightHand;
|
||||
private Vector3 PlayerPositionPreviousFrame;
|
||||
private Vector3 PlayerPositionCurrentFrame;
|
||||
private Vector3 PositionCurrentFrameLeftHand;
|
||||
private Vector3 PositionCurrentFrameRightHand;
|
||||
|
||||
public float Speed;
|
||||
private float HandSpeed;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
PlayerPositionPreviousFrame = transform.position;
|
||||
PositionPreviousFrameLeftHand = LeftHand.transform.position;
|
||||
PlayerPositionPreviousFrame = RightHand.transform.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
||||
|
||||
float Yrot = CenterEyeCamera.transform.eulerAngles.y;
|
||||
ForwardDirection.transform.eulerAngles = new Vector3(0, Yrot, 0);
|
||||
|
||||
PositionCurrentFrameLeftHand = LeftHand.transform.position;
|
||||
PositionCurrentFrameRightHand = RightHand.transform.position;
|
||||
|
||||
PlayerPositionCurrentFrame = transform.position;
|
||||
|
||||
//Debug.Log("Previous" + PositionPreviousFrameLeftHand);
|
||||
//Debug.Log("Current" + PositionCurrentFrameLeftHand);
|
||||
|
||||
var playerDistanceMoved = Vector3.Distance(PlayerPositionCurrentFrame, PlayerPositionPreviousFrame);
|
||||
var leftHandDistanceMoved = Vector3.Distance(PositionCurrentFrameLeftHand, PositionPreviousFrameLeftHand);
|
||||
var rightHandDistanceMoved = Vector3.Distance(PositionCurrentFrameRightHand, PositionPreviousFrameRightHand);
|
||||
|
||||
HandSpeed = ((leftHandDistanceMoved - playerDistanceMoved) + (rightHandDistanceMoved - playerDistanceMoved));
|
||||
|
||||
if (Time.timeSinceLevelLoad > 1f)
|
||||
{
|
||||
transform.position += ForwardDirection.transform.forward * HandSpeed * Speed * Time.deltaTime;
|
||||
}
|
||||
|
||||
PositionPreviousFrameLeftHand = PositionCurrentFrameLeftHand;
|
||||
PositionPreviousFrameRightHand = PositionCurrentFrameRightHand;
|
||||
|
||||
PlayerPositionPreviousFrame = PlayerPositionCurrentFrame;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb6b66c1ad57ba249be7d5b3edef8a9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user