mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-11-12 09:35:55 +08:00
fxi wirecapsule rotation
This commit is contained in:
parent
2c376088a7
commit
5b64866ca4
@ -292,8 +292,7 @@ namespace DCFApixels
|
||||
[IN(LINE)]
|
||||
private DrawHandler LineWireCapsule_Internal(Vector3 startPoint1, Vector3 startPoint2, Vector3 startCenter, Vector3 end, float radius)
|
||||
{
|
||||
Quaternion rotation = Quaternion.LookRotation(startPoint2 - startPoint1, Vector3.up);
|
||||
rotation = rotation * Quaternion.Euler(90, 0, 0);
|
||||
Quaternion rotation = Quaternion.LookRotation(startPoint2 - startPoint1, Vector3.up) * _rot_x_90;
|
||||
LineWireCapsule(startCenter, end, rotation, radius, Vector3.Distance(startPoint1, startPoint2) + radius * 2f);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -14,6 +14,8 @@ namespace DCFApixels
|
||||
{
|
||||
public readonly partial struct DrawHandler
|
||||
{
|
||||
private static Quaternion _rot_x_90 = Quaternion.Euler(90, 0, 0);
|
||||
|
||||
#region BillboardCircle
|
||||
[IN(LINE)]
|
||||
public DrawHandler BillboardCircle(Vector3 position, float radius)
|
||||
@ -300,6 +302,13 @@ namespace DCFApixels
|
||||
|
||||
|
||||
#region Capsule
|
||||
public DrawHandler Capsule<TMat>(Vector3 point1, Vector3 point2, float radius)
|
||||
where TMat : struct, IStaticMaterial
|
||||
{
|
||||
//var norm = Vector3.Cross(Vector3.Normalize(point2 - point1), Vector3.up);
|
||||
var norm = Vector3.Normalize(point2 - point1);
|
||||
return Capsule<TMat>((point1 + point2) * 0.5f, Quaternion.LookRotation(norm, Vector3.up) * _rot_x_90, radius, Vector3.Distance(point1, point2));
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler Capsule<TMat>(Vector3 position, Quaternion rotation, float radius, float height)
|
||||
where TMat : struct, IStaticMaterial
|
||||
@ -316,6 +325,13 @@ namespace DCFApixels
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler Capsule(Vector3 point1, Vector3 point2, float radius)
|
||||
{
|
||||
//var norm = Vector3.Cross(Vector3.Normalize(point2 - point1), Vector3.up);
|
||||
var norm = Vector3.Normalize(point2 - point1);
|
||||
return Capsule((point1 + point2) * 0.5f, Quaternion.LookRotation(norm, Vector3.up) * _rot_x_90, radius, Vector3.Distance(point1, point2));
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler Capsule(Vector3 position, Quaternion rotation, float radius, float height)
|
||||
{
|
||||
return Capsule<LitMat>(position, rotation, radius, height);
|
||||
@ -325,8 +341,9 @@ namespace DCFApixels
|
||||
#region WireCapsule
|
||||
public DrawHandler WireCapsule(Vector3 point1, Vector3 point2, float radius)
|
||||
{
|
||||
//TODO посмотреть поворот
|
||||
return WireCapsule((point1 + point2) * 0.5f, Quaternion.LookRotation(point2 - point1), radius, Vector3.Distance(point1, point2));
|
||||
//var norm = Vector3.Cross(Vector3.Normalize(point2 - point1), Vector3.up);
|
||||
var norm = Vector3.Normalize(point2 - point1);
|
||||
return WireCapsule((point1 + point2) * 0.5f, Quaternion.LookRotation(norm, Vector3.up) * _rot_x_90, radius, Vector3.Distance(point1, point2));
|
||||
}
|
||||
public DrawHandler WireCapsule(Vector3 position, Quaternion rotation, float radius, float height)
|
||||
{
|
||||
|
||||
@ -100,8 +100,7 @@ namespace DCFApixels
|
||||
public DrawHandler CapsuleCast(Vector3 point1, Vector3 point2, Vector3 direction, float radius, RaycastHit hit)
|
||||
{
|
||||
Vector3 center = (point1 + point2) * 0.5f;
|
||||
Quaternion rotation = Quaternion.LookRotation(point2 - point1, Vector3.up);
|
||||
rotation = rotation * Quaternion.Euler(90, 0, 0);
|
||||
Quaternion rotation = Quaternion.LookRotation(point2 - point1, Vector3.up) * _rot_x_90;
|
||||
CapsuleCast(center, direction, rotation, radius, Vector3.Distance(point1, point2) + radius * 2f, hit);
|
||||
return this;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user