PC-20230316NUNE\Administrator b6461675a8 提交代码
2024-01-31 19:16:05 +08:00

37 lines
980 B
C#

using BepuPhysics;
using BepuPhysics.Collidables;
using UnityEngine;
using NotImplementedException = System.NotImplementedException;
using Quaternion = System.Numerics.Quaternion;
using Vector3 = System.Numerics.Vector3;
namespace Plugins.JNGame.BepuPhysics.Components
{
public class BPhysicsBox : BPhysicsBase
{
private BodyHandle bodyId;
void Awake()
{
if (this.Physics == null) return;
Debug.Log("BPhysicsSphere");
this.Physics.Shapes.Add(this);
var localScale = transform.localScale;
var sphereBox = new Box(localScale.x,localScale.y,localScale.z);
if (this.isStatic)
{
this.AddStatic(sphereBox);
}
else
{
sphereBox.ComputeInertia(0.5f, out var inertia);
this.AddDynamic(sphereBox,inertia);
}
}
}
}