mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
37 lines
980 B
C#
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);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
} |