adjusted physics layers & body manager
This commit is contained in:
@@ -3,15 +3,26 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
|
||||
public class SpawnRB : MonoBehaviour
|
||||
public class BodyManager : MonoBehaviour
|
||||
{
|
||||
public static BodyManager Instance { get; private set; }
|
||||
|
||||
public Body m_Rigidbody;
|
||||
public ObjectPool<Body> m_Pool;
|
||||
public float m_SpawnTime;
|
||||
public int m_DefaultPoolCapacity;
|
||||
public int m_MaxPoolCapacity;
|
||||
public Transform m_Parent;
|
||||
private Vector3 m_PelvisPosition;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
Destroy(this);
|
||||
else
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (m_Rigidbody == null)
|
||||
@@ -25,7 +36,7 @@ public class SpawnRB : MonoBehaviour
|
||||
private Body CreateBody()
|
||||
{
|
||||
Vector3 spawnPos = this.transform.position;
|
||||
Body body = Instantiate(m_Rigidbody, spawnPos, new Quaternion(Random.Range(0, 180), Random.Range(0, 180), Random.Range(0, 180), Random.Range(0, 180)));
|
||||
Body body = Instantiate(m_Rigidbody, spawnPos, new Quaternion(Random.Range(0, 180), Random.Range(0, 180), Random.Range(0, 180), Random.Range(0, 180)), m_Parent);
|
||||
body.m_Pelvis.gameObject.GetComponent<Rigidbody>().AddForce(new Vector3(1, 1, 1));
|
||||
m_PelvisPosition = body.m_Pelvis.position;
|
||||
body.SetPool(m_Pool);
|
||||
Reference in New Issue
Block a user