您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
39 行
929 B
39 行
929 B
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using UnityEngine;
|
|
using static Unity.Mathematics.math;
|
|
namespace Primitives
|
|
{
|
|
using Unity.Mathematics;
|
|
|
|
[Serializable]
|
|
public struct capsule
|
|
{
|
|
public float3 p1;
|
|
public float3 p2;
|
|
public float radius;
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public capsule(float3 p1, float3 p2, float radius)
|
|
{
|
|
this.p1 = p1;
|
|
this.p2 = p2;
|
|
this.radius = radius;
|
|
}
|
|
}
|
|
|
|
public static partial class primlib
|
|
{
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static capsule capsule(float3 p1, float3 p2, float radius) { return new capsule(p1, p2, radius); }
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static capsule transform(capsule prim, float3 position, Quaternion rotation)
|
|
{
|
|
prim.p1 = rotation * prim.p1 + (Vector3) position;
|
|
prim.p2 = rotation * prim.p2 + (Vector3) position;
|
|
return prim;
|
|
}
|
|
}
|
|
}
|
|
|