new character

This commit is contained in:
2022-03-29 12:28:30 +03:00
parent c10f3421f5
commit a71043121f
791 changed files with 99475 additions and 45 deletions

View File

@@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Projectile : MonoBehaviour
{
private bool collided;
private void onCollisionEnter(Collider other)
{
if (other.gameObject.tag != "IceBolt" && other.gameObject.tag != "Player" && !collided)
{
collided = true;
Destroy(gameObject);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4bdcdc21af179024f86b724696cc5425
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VRFootIK : MonoBehaviour
{
private Animator animator;
public Vector3 footOffset;
[Range(0,1)]
public float rightFootPosWeight = 1;
[Range(0, 1)]
public float rightFootRotWeight = 1;
[Range(0,1)]
public float leftFootPosWeight = 1;
[Range(0, 1)]
public float leftFootRotWeight = 1;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
}
private void OnAnimatorIK(int layerIndex)
{
Vector3 rightFootPos = animator.GetIKPosition(AvatarIKGoal.RightFoot);
RaycastHit hit;
bool hasHit = Physics.Raycast(rightFootPos + Vector3.up, Vector3.down, out hit);
if (hasHit)
{
animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, rightFootPosWeight);
animator.SetIKPosition(AvatarIKGoal.RightFoot, hit.point + footOffset);
Quaternion rightFootRotation = Quaternion.LookRotation(Vector3.ProjectOnPlane(transform.forward, hit.normal), hit.normal);
animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, rightFootRotWeight);
animator.SetIKRotation(AvatarIKGoal.RightFoot, rightFootRotation);
}
else
{
animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, 0);
}
Vector3 leftFootPos = animator.GetIKPosition(AvatarIKGoal.LeftFoot);
hasHit = Physics.Raycast(leftFootPos + Vector3.up, Vector3.down, out hit);
if (hasHit)
{
animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, leftFootPosWeight);
animator.SetIKPosition(AvatarIKGoal.LeftFoot, hit.point + footOffset);
Quaternion leftFootRotation = Quaternion.LookRotation(Vector3.ProjectOnPlane(transform.forward, hit.normal), hit.normal);
animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, leftFootRotWeight);
animator.SetIKRotation(AvatarIKGoal.LeftFoot, leftFootRotation);
}
else
{
animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 0);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 489f722b392a008499758ea06e3bda7f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class VRMap
{
public Transform vrTarget;
public Transform rigTarget;
public Vector3 trackingOffsetPosition;
public Vector3 trackingOffsetRotation;
public void Map()
{
rigTarget.position = vrTarget.TransformPoint(trackingOffsetPosition);
rigTarget.rotation = vrTarget.rotation * Quaternion.Euler(trackingOffsetRotation);
}
}
public class VRRig : MonoBehaviour
{
public VRMap head;
public VRMap leftHand;
public VRMap rightHand;
public int turnSmoothness;
public Transform headConstraint;
public Vector3 headBodyOffset;
// Start is called before the first frame update
void Start()
{
headBodyOffset = transform.position - headConstraint.position;
}
// Update is called once per frame
void FixedUpdate()
{
transform.position = headConstraint.position + headBodyOffset;
transform.forward = Vector3.Lerp(transform.forward, Vector3.ProjectOnPlane(headConstraint.up, Vector3.up).normalized, Time.deltaTime * turnSmoothness);
head.Map();
leftHand.Map();
rightHand.Map();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8d4f034370f69a84faf5274134e6b252
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class spellcaster : MonoBehaviour
{
public GameObject projectile;
public float projectileSpeed;
void Update()
{
if (true)
{
GameObject icebolt = Instantiate(projectile, transform) as GameObject;
Rigidbody rb = icebolt.GetComponent<Rigidbody>();
rb.velocity = transform.forward * projectileSpeed;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bc8c79dff8f73b849b464e080d71bbc3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: