This commit is contained in:
AndresTraks 2017-07-09 20:01:59 +03:00
Родитель 0ff0281b64
Коммит 6a1aa8ad76
31 изменённых файлов: 2479 добавлений и 2711 удалений

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -29,95 +29,95 @@ namespace BulletSharp
: base(btConeTwistConstraint_new2(rigidBodyA.Native, ref rigidBodyAFrame))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
_rigidBodyB = GetFixedBody();
}
public void CalcAngleInfo()
{
btConeTwistConstraint_calcAngleInfo(_native);
btConeTwistConstraint_calcAngleInfo(Native);
}
public void CalcAngleInfo2Ref(ref Matrix transA, ref Matrix transB, ref Matrix invInertiaWorldA,
Matrix invInertiaWorldB)
{
btConeTwistConstraint_calcAngleInfo2(_native, ref transA, ref transB,
ref invInertiaWorldA, ref invInertiaWorldB);
}
public void CalcAngleInfo2Ref(ref Matrix transA, ref Matrix transB, ref Matrix invInertiaWorldA,
Matrix invInertiaWorldB)
{
btConeTwistConstraint_calcAngleInfo2(Native, ref transA, ref transB,
ref invInertiaWorldA, ref invInertiaWorldB);
}
public void CalcAngleInfo2(Matrix transA, Matrix transB, Matrix invInertiaWorldA,
Matrix invInertiaWorldB)
{
btConeTwistConstraint_calcAngleInfo2(_native, ref transA, ref transB,
btConeTwistConstraint_calcAngleInfo2(Native, ref transA, ref transB,
ref invInertiaWorldA, ref invInertiaWorldB);
}
public void EnableMotor(bool b)
{
btConeTwistConstraint_enableMotor(_native, b);
btConeTwistConstraint_enableMotor(Native, b);
}
public void GetInfo2NonVirtualRef(ConstraintInfo2 info, ref Matrix transA, ref Matrix transB,
Matrix invInertiaWorldA, Matrix invInertiaWorldB)
{
btConeTwistConstraint_getInfo2NonVirtual(_native, info._native, ref transA,
ref transB, ref invInertiaWorldA, ref invInertiaWorldB);
}
public void GetInfo2NonVirtualRef(ConstraintInfo2 info, ref Matrix transA, ref Matrix transB,
Matrix invInertiaWorldA, Matrix invInertiaWorldB)
{
btConeTwistConstraint_getInfo2NonVirtual(Native, info._native, ref transA,
ref transB, ref invInertiaWorldA, ref invInertiaWorldB);
}
public void GetInfo2NonVirtual(ConstraintInfo2 info, Matrix transA, Matrix transB,
Matrix invInertiaWorldA, Matrix invInertiaWorldB)
{
btConeTwistConstraint_getInfo2NonVirtual(_native, info._native, ref transA,
btConeTwistConstraint_getInfo2NonVirtual(Native, info._native, ref transA,
ref transB, ref invInertiaWorldA, ref invInertiaWorldB);
}
public float GetLimit(int limitIndex)
{
return btConeTwistConstraint_getLimit(_native, limitIndex);
return btConeTwistConstraint_getLimit(Native, limitIndex);
}
public Vector3 GetPointForAngle(float fAngleInRadians, float fLength)
{
Vector3 value;
btConeTwistConstraint_GetPointForAngle(_native, fAngleInRadians, fLength,
btConeTwistConstraint_GetPointForAngle(Native, fAngleInRadians, fLength,
out value);
return value;
}
public void SetFramesRef(ref Matrix frameA, ref Matrix frameB)
{
btConeTwistConstraint_setFrames(_native, ref frameA, ref frameB);
}
public void SetFramesRef(ref Matrix frameA, ref Matrix frameB)
{
btConeTwistConstraint_setFrames(Native, ref frameA, ref frameB);
}
public void SetFrames(Matrix frameA, Matrix frameB)
{
btConeTwistConstraint_setFrames(_native, ref frameA, ref frameB);
btConeTwistConstraint_setFrames(Native, ref frameA, ref frameB);
}
public void SetLimit(int limitIndex, float limitValue)
{
btConeTwistConstraint_setLimit(_native, limitIndex, limitValue);
btConeTwistConstraint_setLimit(Native, limitIndex, limitValue);
}
public void SetLimit(float swingSpan1, float swingSpan2, float twistSpan,
float softness = 1.0f, float biasFactor = 0.3f, float relaxationFactor = 1.0f)
{
btConeTwistConstraint_setLimit2(_native, swingSpan1, swingSpan2, twistSpan,
btConeTwistConstraint_setLimit2(Native, swingSpan1, swingSpan2, twistSpan,
softness, biasFactor, relaxationFactor);
}
public void SetMaxMotorImpulseNormalized(float maxMotorImpulse)
{
btConeTwistConstraint_setMaxMotorImpulseNormalized(_native, maxMotorImpulse);
btConeTwistConstraint_setMaxMotorImpulseNormalized(Native, maxMotorImpulse);
}
public void SetMotorTargetInConstraintSpace(Quaternion q)
{
btConeTwistConstraint_setMotorTargetInConstraintSpace(_native, ref q);
btConeTwistConstraint_setMotorTargetInConstraintSpace(Native, ref q);
}
public void UpdateRhs(float timeStep)
{
btConeTwistConstraint_updateRHS(_native, timeStep);
btConeTwistConstraint_updateRHS(Native, timeStep);
}
public Matrix AFrame
@ -125,15 +125,15 @@ namespace BulletSharp
get
{
Matrix value;
btConeTwistConstraint_getAFrame(_native, out value);
btConeTwistConstraint_getAFrame(Native, out value);
return value;
}
}
public bool AngularOnly
{
get { return btConeTwistConstraint_getAngularOnly(_native); }
set { btConeTwistConstraint_setAngularOnly(_native, value); }
get => btConeTwistConstraint_getAngularOnly(Native);
set => btConeTwistConstraint_setAngularOnly(Native, value);
}
public Matrix BFrame
@ -141,39 +141,33 @@ namespace BulletSharp
get
{
Matrix value;
btConeTwistConstraint_getBFrame(_native, out value);
btConeTwistConstraint_getBFrame(Native, out value);
return value;
}
}
public float BiasFactor
{
get { return btConeTwistConstraint_getBiasFactor(_native); }
}
public float BiasFactor => btConeTwistConstraint_getBiasFactor(Native);
public float Damping
{
get { return btConeTwistConstraint_getDamping(_native); }
set { btConeTwistConstraint_setDamping(_native, value); }
get => btConeTwistConstraint_getDamping(Native);
set => btConeTwistConstraint_setDamping(Native, value);
}
public float FixThresh
{
get { return btConeTwistConstraint_getFixThresh(_native); }
set { btConeTwistConstraint_setFixThresh(_native, value); }
get => btConeTwistConstraint_getFixThresh(Native);
set => btConeTwistConstraint_setFixThresh(Native, value);
}
public ConeTwistFlags Flags
{
get { return btConeTwistConstraint_getFlags(_native); }
}
public ConeTwistFlags Flags => btConeTwistConstraint_getFlags(Native);
public Matrix FrameOffsetA
{
get
{
Matrix value;
btConeTwistConstraint_getFrameOffsetA(_native, out value);
btConeTwistConstraint_getFrameOffsetA(Native, out value);
return value;
}
}
@ -183,35 +177,22 @@ namespace BulletSharp
get
{
Matrix value;
btConeTwistConstraint_getFrameOffsetB(_native, out value);
btConeTwistConstraint_getFrameOffsetB(Native, out value);
return value;
}
}
public bool IsMaxMotorImpulseNormalized
{
get { return btConeTwistConstraint_isMaxMotorImpulseNormalized(_native); }
}
public bool IsMaxMotorImpulseNormalized => btConeTwistConstraint_isMaxMotorImpulseNormalized(Native);
public bool IsMotorEnabled
{
get { return btConeTwistConstraint_isMotorEnabled(_native); }
}
public bool IsMotorEnabled => btConeTwistConstraint_isMotorEnabled(Native);
public bool IsPastSwingLimit
{
get { return btConeTwistConstraint_isPastSwingLimit(_native); }
}
public bool IsPastSwingLimit => btConeTwistConstraint_isPastSwingLimit(Native);
public float LimitSoftness
{
get { return btConeTwistConstraint_getLimitSoftness(_native); }
}
public float LimitSoftness => btConeTwistConstraint_getLimitSoftness(Native);
public float MaxMotorImpulse
{
get { return btConeTwistConstraint_getMaxMotorImpulse(_native); }
set { btConeTwistConstraint_setMaxMotorImpulse(_native, value); }
get => btConeTwistConstraint_getMaxMotorImpulse(Native); set => btConeTwistConstraint_setMaxMotorImpulse(Native, value);
}
public Quaternion MotorTarget
@ -219,159 +200,37 @@ namespace BulletSharp
get
{
Quaternion value;
btConeTwistConstraint_getMotorTarget(_native, out value);
btConeTwistConstraint_getMotorTarget(Native, out value);
return value;
}
set { btConeTwistConstraint_setMotorTarget(_native, ref value); }
set => btConeTwistConstraint_setMotorTarget(Native, ref value);
}
public float RelaxationFactor
{
get { return btConeTwistConstraint_getRelaxationFactor(_native); }
}
public int SolveSwingLimit
{
get { return btConeTwistConstraint_getSolveSwingLimit(_native); }
}
public int SolveTwistLimit
{
get { return btConeTwistConstraint_getSolveTwistLimit(_native); }
}
public float SwingSpan1
{
get { return btConeTwistConstraint_getSwingSpan1(_native); }
}
public float SwingSpan2
{
get { return btConeTwistConstraint_getSwingSpan2(_native); }
}
public float TwistAngle
{
get { return btConeTwistConstraint_getTwistAngle(_native); }
}
public float TwistLimitSign
{
get { return btConeTwistConstraint_getTwistLimitSign(_native); }
}
public float TwistSpan
{
get { return btConeTwistConstraint_getTwistSpan(_native); }
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btConeTwistConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Matrix rbAFrame, [In] ref Matrix rbBFrame);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btConeTwistConstraint_new2(IntPtr rbA, [In] ref Matrix rbAFrame);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_calcAngleInfo(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_calcAngleInfo2(IntPtr obj, [In] ref Matrix transA, [In] ref Matrix transB, [In] ref Matrix invInertiaWorldA, [In] ref Matrix invInertiaWorldB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_enableMotor(IntPtr obj, bool b);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getAFrame(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btConeTwistConstraint_getAngularOnly(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getBFrame(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getBiasFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getFixThresh(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern ConeTwistFlags btConeTwistConstraint_getFlags(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getFrameOffsetA(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getFrameOffsetB(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getInfo1NonVirtual(IntPtr obj, IntPtr info);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getInfo2NonVirtual(IntPtr obj, IntPtr info, [In] ref Matrix transA, [In] ref Matrix transB, [In] ref Matrix invInertiaWorldA, [In] ref Matrix invInertiaWorldB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getLimit(IntPtr obj, int limitIndex);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getLimitSoftness(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getMaxMotorImpulse(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_getMotorTarget(IntPtr obj, out Quaternion q);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_GetPointForAngle(IntPtr obj, float fAngleInRadians, float fLength, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getRelaxationFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btConeTwistConstraint_getSolveSwingLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btConeTwistConstraint_getSolveTwistLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getSwingSpan1(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getSwingSpan2(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getTwistAngle(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getTwistLimitSign(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConeTwistConstraint_getTwistSpan(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btConeTwistConstraint_isMaxMotorImpulseNormalized(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btConeTwistConstraint_isMotorEnabled(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btConeTwistConstraint_isPastSwingLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setAngularOnly(IntPtr obj, bool angularOnly);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setDamping(IntPtr obj, float damping);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setFixThresh(IntPtr obj, float fixThresh);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setFrames(IntPtr obj, [In] ref Matrix frameA, [In] ref Matrix frameB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setLimit(IntPtr obj, int limitIndex, float limitValue);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setLimit2(IntPtr obj, float _swingSpan1, float _swingSpan2, float _twistSpan, float _softness, float _biasFactor, float _relaxationFactor);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setMaxMotorImpulse(IntPtr obj, float maxMotorImpulse);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setMaxMotorImpulseNormalized(IntPtr obj, float maxMotorImpulse);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setMotorTarget(IntPtr obj, [In] ref Quaternion q);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_setMotorTargetInConstraintSpace(IntPtr obj, [In] ref Quaternion q);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConeTwistConstraint_updateRHS(IntPtr obj, float timeStep);
public float RelaxationFactor => btConeTwistConstraint_getRelaxationFactor(Native);
public int SolveSwingLimit => btConeTwistConstraint_getSolveSwingLimit(Native);
public int SolveTwistLimit => btConeTwistConstraint_getSolveTwistLimit(Native);
public float SwingSpan1 => btConeTwistConstraint_getSwingSpan1(Native);
public float SwingSpan2 => btConeTwistConstraint_getSwingSpan2(Native);
public float TwistAngle => btConeTwistConstraint_getTwistAngle(Native);
public float TwistLimitSign => btConeTwistConstraint_getTwistLimitSign(Native);
public float TwistSpan => btConeTwistConstraint_getTwistSpan(Native);
}
[StructLayout(LayoutKind.Sequential)]
internal struct ConeTwistConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public TransformFloatData RigidBodyAFrame;
public TransformFloatData RigidBodyBFrame;
public float SwingSpan1;
public float SwingSpan2;
public float TwistSpan;
public float LimitSoftness;
public float BiasFactor;
public float RelaxationFactor;
public float Damping;
public int Pad;
[StructLayout(LayoutKind.Sequential)]
internal struct ConeTwistConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public TransformFloatData RigidBodyAFrame;
public TransformFloatData RigidBodyBFrame;
public float SwingSpan1;
public float SwingSpan2;
public float TwistSpan;
public float LimitSoftness;
public float BiasFactor;
public float RelaxationFactor;
public float Damping;
public int Pad;
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(ConeTwistConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(ConeTwistConstraintFloatData), fieldName).ToInt32(); }
}
}

Просмотреть файл

@ -1,55 +1,51 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
public enum ConstraintSolverType
{
SequentialImpulse = 1,
Mlcp = 2,
Nncg = 4
SequentialImpulse = 1,
Mlcp = 2,
Nncg = 4
}
public abstract class ConstraintSolver : IDisposable
{
internal IntPtr _native;
bool _preventDelete;
internal IntPtr Native;
private bool _preventDelete;
internal ConstraintSolver(IntPtr native, bool preventDelete)
{
_native = native;
Native = native;
_preventDelete = preventDelete;
}
public void AllSolved(ContactSolverInfo __unnamed0, IDebugDraw __unnamed1)
{
btConstraintSolver_allSolved(_native, __unnamed0._native, DebugDraw.GetUnmanaged(__unnamed1));
btConstraintSolver_allSolved(Native, __unnamed0.Native, DebugDraw.GetUnmanaged(__unnamed1));
}
public void PrepareSolve(int __unnamed0, int __unnamed1)
{
btConstraintSolver_prepareSolve(_native, __unnamed0, __unnamed1);
btConstraintSolver_prepareSolve(Native, __unnamed0, __unnamed1);
}
public void Reset()
{
btConstraintSolver_reset(_native);
btConstraintSolver_reset(Native);
}
/*
/*
public float SolveGroup(CollisionObject bodies, int numBodies, PersistentManifold manifold,
int numManifolds, TypedConstraint constraints, int numConstraints, ContactSolverInfo info,
IDebugDraw debugDrawer, Dispatcher dispatcher)
{
return btConstraintSolver_solveGroup(_native, bodies._native, numBodies,
return btConstraintSolver_solveGroup(Native, bodies._native, numBodies,
manifold._native, numManifolds, constraints._native, numConstraints,
info._native, DebugDraw.GetUnmanaged(debugDrawer), dispatcher._native);
}
*/
public ConstraintSolverType SolverType
{
get { return btConstraintSolver_getSolverType(_native); }
}
*/
public ConstraintSolverType SolverType => btConstraintSolver_getSolverType(Native);
public void Dispose()
{
@ -59,13 +55,13 @@ namespace BulletSharp
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
if (Native != IntPtr.Zero)
{
if (!_preventDelete)
{
btConstraintSolver_delete(_native);
btConstraintSolver_delete(Native);
}
_native = IntPtr.Zero;
Native = IntPtr.Zero;
}
}
@ -73,18 +69,5 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSolver_allSolved(IntPtr obj, IntPtr __unnamed0, IntPtr __unnamed1);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern ConstraintSolverType btConstraintSolver_getSolverType(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSolver_prepareSolve(IntPtr obj, int __unnamed0, int __unnamed1);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSolver_reset(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConstraintSolver_solveGroup(IntPtr obj, IntPtr bodies, int numBodies, IntPtr manifold, int numManifolds, IntPtr constraints, int numConstraints, IntPtr info, IntPtr debugDrawer, IntPtr dispatcher);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSolver_delete(IntPtr obj);
}
}

Просмотреть файл

@ -1,16 +1,15 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
[Flags]
public enum SolverModes
public enum SolverModes
{
None = 0,
RandomizeOrder = 1,
RandomizeOrder = 1,
FrictionSeparate = 2,
UseWarmStarting = 4,
UseWarmStarting = 4,
Use2FrictionDirections = 16,
EnableFrictionDirectionCaching = 32,
DisableVelocityDependentFrictionDirection = 64,
@ -22,156 +21,156 @@ namespace BulletSharp
public class ContactSolverInfoData : IDisposable
{
internal IntPtr _native;
bool _preventDelete;
internal IntPtr Native;
private bool _preventDelete;
internal ContactSolverInfoData(IntPtr native, bool preventDelete)
{
_native = native;
Native = native;
_preventDelete = preventDelete;
}
public ContactSolverInfoData()
{
_native = btContactSolverInfoData_new();
Native = btContactSolverInfoData_new();
}
public float Damping
{
get { return btContactSolverInfoData_getDamping(_native); }
set { btContactSolverInfoData_setDamping(_native, value); }
get => btContactSolverInfoData_getDamping(Native);
set => btContactSolverInfoData_setDamping(Native, value);
}
public float Erp
{
get { return btContactSolverInfoData_getErp(_native); }
set { btContactSolverInfoData_setErp(_native, value); }
get => btContactSolverInfoData_getErp(Native);
set => btContactSolverInfoData_setErp(Native, value);
}
public float Erp2
{
get { return btContactSolverInfoData_getErp2(_native); }
set { btContactSolverInfoData_setErp2(_native, value); }
get => btContactSolverInfoData_getErp2(Native);
set => btContactSolverInfoData_setErp2(Native, value);
}
public float Friction
{
get { return btContactSolverInfoData_getFriction(_native); }
set { btContactSolverInfoData_setFriction(_native, value); }
get => btContactSolverInfoData_getFriction(Native);
set => btContactSolverInfoData_setFriction(Native, value);
}
public float FrictionCfm
{
get { return btContactSolverInfoData_getFrictionCfm(_native); }
set { btContactSolverInfoData_setFrictionCfm(_native, value); }
get => btContactSolverInfoData_getFrictionCfm(Native);
set => btContactSolverInfoData_setFrictionCfm(Native, value);
}
public float FrictionErp
{
get { return btContactSolverInfoData_getFrictionErp(_native); }
set { btContactSolverInfoData_setFrictionErp(_native, value); }
get => btContactSolverInfoData_getFrictionErp(Native);
set => btContactSolverInfoData_setFrictionErp(Native, value);
}
public float GlobalCfm
{
get { return btContactSolverInfoData_getGlobalCfm(_native); }
set { btContactSolverInfoData_setGlobalCfm(_native, value); }
get => btContactSolverInfoData_getGlobalCfm(Native);
set => btContactSolverInfoData_setGlobalCfm(Native, value);
}
public float LinearSlop
{
get { return btContactSolverInfoData_getLinearSlop(_native); }
set { btContactSolverInfoData_setLinearSlop(_native, value); }
get => btContactSolverInfoData_getLinearSlop(Native);
set => btContactSolverInfoData_setLinearSlop(Native, value);
}
public float MaxErrorReduction
{
get { return btContactSolverInfoData_getMaxErrorReduction(_native); }
set { btContactSolverInfoData_setMaxErrorReduction(_native, value); }
get => btContactSolverInfoData_getMaxErrorReduction(Native);
set => btContactSolverInfoData_setMaxErrorReduction(Native, value);
}
public float MaxGyroscopicForce
{
get { return btContactSolverInfoData_getMaxGyroscopicForce(_native); }
set { btContactSolverInfoData_setMaxGyroscopicForce(_native, value); }
get => btContactSolverInfoData_getMaxGyroscopicForce(Native);
set => btContactSolverInfoData_setMaxGyroscopicForce(Native, value);
}
public int MinimumSolverBatchSize
{
get { return btContactSolverInfoData_getMinimumSolverBatchSize(_native); }
set { btContactSolverInfoData_setMinimumSolverBatchSize(_native, value); }
get => btContactSolverInfoData_getMinimumSolverBatchSize(Native);
set => btContactSolverInfoData_setMinimumSolverBatchSize(Native, value);
}
public int NumIterations
{
get { return btContactSolverInfoData_getNumIterations(_native); }
set { btContactSolverInfoData_setNumIterations(_native, value); }
get => btContactSolverInfoData_getNumIterations(Native);
set => btContactSolverInfoData_setNumIterations(Native, value);
}
public int RestingContactRestitutionThreshold
{
get { return btContactSolverInfoData_getRestingContactRestitutionThreshold(_native); }
set { btContactSolverInfoData_setRestingContactRestitutionThreshold(_native, value); }
get => btContactSolverInfoData_getRestingContactRestitutionThreshold(Native);
set => btContactSolverInfoData_setRestingContactRestitutionThreshold(Native, value);
}
public float Restitution
{
get { return btContactSolverInfoData_getRestitution(_native); }
set { btContactSolverInfoData_setRestitution(_native, value); }
get => btContactSolverInfoData_getRestitution(Native);
set => btContactSolverInfoData_setRestitution(Native, value);
}
public float SingleAxisRollingFrictionThreshold
{
get { return btContactSolverInfoData_getSingleAxisRollingFrictionThreshold(_native); }
set { btContactSolverInfoData_setSingleAxisRollingFrictionThreshold(_native, value); }
get => btContactSolverInfoData_getSingleAxisRollingFrictionThreshold(Native);
set => btContactSolverInfoData_setSingleAxisRollingFrictionThreshold(Native, value);
}
public SolverModes SolverMode
public SolverModes SolverMode
{
get { return btContactSolverInfoData_getSolverMode(_native); }
set { btContactSolverInfoData_setSolverMode(_native, value); }
get => btContactSolverInfoData_getSolverMode(Native);
set => btContactSolverInfoData_setSolverMode(Native, value);
}
public float Sor
{
get { return btContactSolverInfoData_getSor(_native); }
set { btContactSolverInfoData_setSor(_native, value); }
get => btContactSolverInfoData_getSor(Native);
set => btContactSolverInfoData_setSor(Native, value);
}
public int SplitImpulse
{
get { return btContactSolverInfoData_getSplitImpulse(_native); }
set { btContactSolverInfoData_setSplitImpulse(_native, value); }
get => btContactSolverInfoData_getSplitImpulse(Native);
set => btContactSolverInfoData_setSplitImpulse(Native, value);
}
public float SplitImpulsePenetrationThreshold
{
get { return btContactSolverInfoData_getSplitImpulsePenetrationThreshold(_native); }
set { btContactSolverInfoData_setSplitImpulsePenetrationThreshold(_native, value); }
get => btContactSolverInfoData_getSplitImpulsePenetrationThreshold(Native);
set => btContactSolverInfoData_setSplitImpulsePenetrationThreshold(Native, value);
}
public float SplitImpulseTurnErp
{
get { return btContactSolverInfoData_getSplitImpulseTurnErp(_native); }
set { btContactSolverInfoData_setSplitImpulseTurnErp(_native, value); }
get => btContactSolverInfoData_getSplitImpulseTurnErp(Native);
set => btContactSolverInfoData_setSplitImpulseTurnErp(Native, value);
}
public float Tau
{
get { return btContactSolverInfoData_getTau(_native); }
set { btContactSolverInfoData_setTau(_native, value); }
get => btContactSolverInfoData_getTau(Native);
set => btContactSolverInfoData_setTau(Native, value);
}
public float TimeStep
{
get { return btContactSolverInfoData_getTimeStep(_native); }
set { btContactSolverInfoData_setTimeStep(_native, value); }
get => btContactSolverInfoData_getTimeStep(Native);
set => btContactSolverInfoData_setTimeStep(Native, value);
}
public float WarmStartingFactor
{
get { return btContactSolverInfoData_getWarmstartingFactor(_native); }
set { btContactSolverInfoData_setWarmstartingFactor(_native, value); }
get => btContactSolverInfoData_getWarmstartingFactor(Native);
set => btContactSolverInfoData_setWarmstartingFactor(Native, value);
}
public void Dispose()
@ -182,13 +181,13 @@ namespace BulletSharp
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
if (Native != IntPtr.Zero)
{
if (!_preventDelete)
{
btContactSolverInfoData_delete(_native);
btContactSolverInfoData_delete(Native);
}
_native = IntPtr.Zero;
Native = IntPtr.Zero;
}
}
@ -196,103 +195,6 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btContactSolverInfoData_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getErp(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getErp2(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getFriction(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getFrictionCfm(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getFrictionErp(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getGlobalCfm(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getLinearSlop(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getMaxErrorReduction(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getMaxGyroscopicForce(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btContactSolverInfoData_getMinimumSolverBatchSize(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btContactSolverInfoData_getNumIterations(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btContactSolverInfoData_getRestingContactRestitutionThreshold(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getRestitution(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getSingleAxisRollingFrictionThreshold(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern SolverModes btContactSolverInfoData_getSolverMode(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getSor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btContactSolverInfoData_getSplitImpulse(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getSplitImpulsePenetrationThreshold(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getSplitImpulseTurnErp(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getTau(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getTimeStep(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btContactSolverInfoData_getWarmstartingFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setDamping(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setErp(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setErp2(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setFriction(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setFrictionCfm(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setFrictionErp(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setGlobalCfm(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setLinearSlop(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setMaxErrorReduction(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setMaxGyroscopicForce(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setMinimumSolverBatchSize(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setNumIterations(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setRestingContactRestitutionThreshold(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setRestitution(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setSingleAxisRollingFrictionThreshold(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setSolverMode(IntPtr obj, SolverModes value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setSor(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setSplitImpulse(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setSplitImpulsePenetrationThreshold(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setSplitImpulseTurnErp(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setTau(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setTimeStep(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_setWarmstartingFactor(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btContactSolverInfoData_delete(IntPtr obj);
}
public class ContactSolverInfo : ContactSolverInfoData
@ -306,8 +208,5 @@ namespace BulletSharp
: base(btContactSolverInfo_new(), false)
{
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btContactSolverInfo_new();
}
}

Просмотреть файл

@ -1,6 +1,5 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -15,8 +14,5 @@ namespace BulletSharp
: base(btDantzigSolver_new())
{
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btDantzigSolver_new();
}
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace BulletSharp
public DiscreteDynamicsWorld(Dispatcher dispatcher, BroadphaseInterface pairCache,
ConstraintSolver constraintSolver, CollisionConfiguration collisionConfiguration)
: this(btDiscreteDynamicsWorld_new(dispatcher != null ? dispatcher.Native : IntPtr.Zero, pairCache != null ? pairCache.Native : IntPtr.Zero,
constraintSolver != null ? constraintSolver._native : IntPtr.Zero, collisionConfiguration != null ? collisionConfiguration.Native : IntPtr.Zero),
constraintSolver != null ? constraintSolver.Native : IntPtr.Zero, collisionConfiguration != null ? collisionConfiguration.Native : IntPtr.Zero),
dispatcher, pairCache)
{
_constraintSolver = constraintSolver;
@ -29,7 +29,7 @@ namespace BulletSharp
public void DebugDrawConstraint(TypedConstraint constraint)
{
btDiscreteDynamicsWorld_debugDrawConstraint(Native, constraint._native);
btDiscreteDynamicsWorld_debugDrawConstraint(Native, constraint.Native);
}
private unsafe void SerializeDynamicsWorldInfo(Serializer serializer)
@ -94,7 +94,7 @@ namespace BulletSharp
int len = constraint.CalculateSerializeBufferSize();
Chunk chunk = serializer.Allocate((uint)len, 1);
string structType = constraint.Serialize(chunk.OldPtr, serializer);
serializer.FinalizeChunk(chunk, structType, DnaID.Constraint, constraint._native);
serializer.FinalizeChunk(chunk, structType, DnaID.Constraint, constraint.Native);
}
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace BulletSharp
public DiscreteDynamicsWorldMultiThreaded(Dispatcher dispatcher, BroadphaseInterface pairCache,
ConstraintSolverPoolMultiThreaded constraintSolver, CollisionConfiguration collisionConfiguration)
: base(btDiscreteDynamicsWorldMt_new(dispatcher != null ? dispatcher.Native : IntPtr.Zero,
pairCache != null ? pairCache.Native : IntPtr.Zero, constraintSolver != null ? constraintSolver._native : IntPtr.Zero,
pairCache != null ? pairCache.Native : IntPtr.Zero, constraintSolver != null ? constraintSolver.Native : IntPtr.Zero,
collisionConfiguration != null ? collisionConfiguration.Native : IntPtr.Zero), dispatcher, pairCache)
{
}

Просмотреть файл

@ -57,7 +57,7 @@ namespace BulletSharp
public void AddConstraint(TypedConstraint constraint, bool disableCollisionsBetweenLinkedBodies = false)
{
_constraints.Add(constraint);
btDynamicsWorld_addConstraint(Native, constraint._native, disableCollisionsBetweenLinkedBodies);
btDynamicsWorld_addConstraint(Native, constraint.Native, disableCollisionsBetweenLinkedBodies);
if (disableCollisionsBetweenLinkedBodies)
{
@ -99,7 +99,7 @@ namespace BulletSharp
public TypedConstraint GetConstraint(int index)
{
System.Diagnostics.Debug.Assert(btDynamicsWorld_getConstraint(Native, index) == _constraints[index]._native);
System.Diagnostics.Debug.Assert(btDynamicsWorld_getConstraint(Native, index) == _constraints[index].Native);
return _constraints[index];
}
@ -142,7 +142,7 @@ namespace BulletSharp
int lastIndex = _constraints.Count - 1;
_constraints[itemIndex] = _constraints[lastIndex];
_constraints.RemoveAt(lastIndex);
btDynamicsWorld_removeConstraint(Native, constraint._native);
btDynamicsWorld_removeConstraint(Native, constraint.Native);
}
public void RemoveRigidBody(RigidBody body)
@ -247,7 +247,7 @@ namespace BulletSharp
set
{
_constraintSolver = value;
btDynamicsWorld_setConstraintSolver(Native, value._native);
btDynamicsWorld_setConstraintSolver(Native, value.Native);
}
}

Просмотреть файл

@ -29,11 +29,11 @@ namespace BulletSharp
debugDrawer._native, dispatcher._native);
}
*/
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btMultiBodyConstraintSolver_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btMultiBodyConstraintSolver_solveGroupCacheFriendlyFinish(IntPtr obj, IntPtr bodies, int numBodies, IntPtr infoGlobal);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[DllImport(BulletSharp.Native.Dll, CallingConvention = BulletSharp.Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btMultiBodyConstraintSolver_solveMultiBodyGroup(IntPtr obj, IntPtr bodies, int numBodies, IntPtr manifold, int numManifolds, IntPtr constraints, int numConstraints, IntPtr multiBodyConstraints, int numMultiBodyConstraints, IntPtr info, IntPtr debugDrawer, IntPtr dispatcher);
}
}

Просмотреть файл

@ -11,7 +11,7 @@ namespace BulletSharp
public MultiBodyDynamicsWorld(Dispatcher dispatcher, BroadphaseInterface pairCache,
MultiBodyConstraintSolver constraintSolver, CollisionConfiguration collisionConfiguration)
: base(btMultiBodyDynamicsWorld_new(dispatcher.Native, pairCache.Native,
constraintSolver._native, collisionConfiguration.Native), dispatcher, pairCache)
constraintSolver.Native, collisionConfiguration.Native), dispatcher, pairCache)
{
_constraintSolver = constraintSolver;

Просмотреть файл

@ -1,7 +1,5 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -15,8 +13,5 @@ namespace BulletSharp
_rigidBodyA = rigidBodyA;
_rigidBodyB = rigidBodyB;
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btFixedConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Matrix frameInA, [In] ref Matrix frameInB);
}
}

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -21,10 +20,10 @@ namespace BulletSharp
get
{
Vector3 value;
btGearConstraint_getAxisA(_native, out value);
btGearConstraint_getAxisA(Native, out value);
return value;
}
set { btGearConstraint_setAxisA(_native, ref value); }
set => btGearConstraint_setAxisA(Native, ref value);
}
public Vector3 AxisB
@ -32,43 +31,28 @@ namespace BulletSharp
get
{
Vector3 value;
btGearConstraint_getAxisB(_native, out value);
btGearConstraint_getAxisB(Native, out value);
return value;
}
set { btGearConstraint_setAxisB(_native, ref value); }
set => btGearConstraint_setAxisB(Native, ref value);
}
public float Ratio
{
get { return btGearConstraint_getRatio(_native); }
set { btGearConstraint_setRatio(_native, value); }
get => btGearConstraint_getRatio(Native);
set => btGearConstraint_setRatio(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btGearConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Vector3 axisInA, [In] ref Vector3 axisInB, float ratio);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGearConstraint_getAxisA(IntPtr obj, out Vector3 axisA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGearConstraint_getAxisB(IntPtr obj, out Vector3 axisB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btGearConstraint_getRatio(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGearConstraint_setAxisA(IntPtr obj, ref Vector3 axisA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGearConstraint_setAxisB(IntPtr obj, ref Vector3 axisB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGearConstraint_setRatio(IntPtr obj, float ratio);
}
[StructLayout(LayoutKind.Sequential)]
internal struct GearConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public Vector3FloatData AxisInA;
public Vector3FloatData AxisInB;
public float Ratio;
public int Padding;
[StructLayout(LayoutKind.Sequential)]
internal struct GearConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public Vector3FloatData AxisInA;
public Vector3FloatData AxisInB;
public float Ratio;
public int Padding;
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(GearConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(GearConstraintFloatData), fieldName).ToInt32(); }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -21,96 +20,70 @@ namespace BulletSharp
: base(btGeneric6DofSpringConstraint_new2(rigidBodyB.Native, ref frameInB,
useLinearReferenceFrameB))
{
_rigidBodyA = GetFixedBody();
_rigidBodyA = GetFixedBody();
_rigidBodyB = rigidBodyB;
}
public void EnableSpring(int index, bool onOff)
{
btGeneric6DofSpringConstraint_enableSpring(_native, index, onOff);
btGeneric6DofSpringConstraint_enableSpring(Native, index, onOff);
}
public float GetDamping(int index)
{
return btGeneric6DofSpringConstraint_getDamping(_native, index);
return btGeneric6DofSpringConstraint_getDamping(Native, index);
}
public float GetEquilibriumPoint(int index)
{
return btGeneric6DofSpringConstraint_getEquilibriumPoint(_native, index);
return btGeneric6DofSpringConstraint_getEquilibriumPoint(Native, index);
}
public float GetStiffness(int index)
{
return btGeneric6DofSpringConstraint_getStiffness(_native, index);
return btGeneric6DofSpringConstraint_getStiffness(Native, index);
}
public bool IsSpringEnabled(int index)
{
return btGeneric6DofSpringConstraint_isSpringEnabled(_native, index);
return btGeneric6DofSpringConstraint_isSpringEnabled(Native, index);
}
public void SetDamping(int index, float damping)
{
btGeneric6DofSpringConstraint_setDamping(_native, index, damping);
btGeneric6DofSpringConstraint_setDamping(Native, index, damping);
}
public void SetEquilibriumPoint()
{
btGeneric6DofSpringConstraint_setEquilibriumPoint(_native);
btGeneric6DofSpringConstraint_setEquilibriumPoint(Native);
}
public void SetEquilibriumPoint(int index)
{
btGeneric6DofSpringConstraint_setEquilibriumPoint2(_native, index);
btGeneric6DofSpringConstraint_setEquilibriumPoint2(Native, index);
}
public void SetEquilibriumPoint(int index, float val)
{
btGeneric6DofSpringConstraint_setEquilibriumPoint3(_native, index, val);
btGeneric6DofSpringConstraint_setEquilibriumPoint3(Native, index, val);
}
public void SetStiffness(int index, float stiffness)
{
btGeneric6DofSpringConstraint_setStiffness(_native, index, stiffness);
btGeneric6DofSpringConstraint_setStiffness(Native, index, stiffness);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btGeneric6DofSpringConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Matrix frameInA, [In] ref Matrix frameInB, bool useLinearReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btGeneric6DofSpringConstraint_new2(IntPtr rbB, [In] ref Matrix frameInB, bool useLinearReferenceFrameB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGeneric6DofSpringConstraint_enableSpring(IntPtr obj, int index, bool onOff);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btGeneric6DofSpringConstraint_getDamping(IntPtr obj, int index);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btGeneric6DofSpringConstraint_getEquilibriumPoint(IntPtr obj, int index);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btGeneric6DofSpringConstraint_getStiffness(IntPtr obj, int index);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btGeneric6DofSpringConstraint_isSpringEnabled(IntPtr obj, int index);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGeneric6DofSpringConstraint_setDamping(IntPtr obj, int index, float damping);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGeneric6DofSpringConstraint_setEquilibriumPoint(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGeneric6DofSpringConstraint_setEquilibriumPoint2(IntPtr obj, int index);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGeneric6DofSpringConstraint_setEquilibriumPoint3(IntPtr obj, int index, float val);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btGeneric6DofSpringConstraint_setStiffness(IntPtr obj, int index, float stiffness);
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Generic6DofSpringConstraintFloatData
{
public Generic6DofConstraintFloatData SixDofData;
public fixed int SpringEnabled[6];
public fixed float EquilibriumPoint[6];
public fixed float SpringStiffness[6];
public fixed float SpringDamping[6];
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Generic6DofSpringConstraintFloatData
{
public Generic6DofConstraintFloatData SixDofData;
public fixed int SpringEnabled[6];
public fixed float EquilibriumPoint[6];
public fixed float SpringStiffness[6];
public fixed float SpringDamping[6];
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(Generic6DofSpringConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(Generic6DofSpringConstraintFloatData), fieldName).ToInt32(); }
}
}

Просмотреть файл

@ -1,7 +1,5 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -18,12 +16,12 @@ namespace BulletSharp
public void SetLowerLimit(float ang1min)
{
btHinge2Constraint_setLowerLimit(_native, ang1min);
btHinge2Constraint_setLowerLimit(Native, ang1min);
}
public void SetUpperLimit(float ang1max)
{
btHinge2Constraint_setUpperLimit(_native, ang1max);
btHinge2Constraint_setUpperLimit(Native, ang1max);
}
public Vector3 Anchor
@ -31,7 +29,7 @@ namespace BulletSharp
get
{
Vector3 value;
btHinge2Constraint_getAnchor(_native, out value);
btHinge2Constraint_getAnchor(Native, out value);
return value;
}
}
@ -41,27 +39,21 @@ namespace BulletSharp
get
{
Vector3 value;
btHinge2Constraint_getAnchor2(_native, out value);
btHinge2Constraint_getAnchor2(Native, out value);
return value;
}
}
public float Angle1
{
get { return btHinge2Constraint_getAngle1(_native); }
}
public float Angle1 => btHinge2Constraint_getAngle1(Native);
public float Angle2
{
get { return btHinge2Constraint_getAngle2(_native); }
}
public float Angle2 => btHinge2Constraint_getAngle2(Native);
public Vector3 Axis1
{
get
{
Vector3 value;
btHinge2Constraint_getAxis1(_native, out value);
btHinge2Constraint_getAxis1(Native, out value);
return value;
}
}
@ -71,28 +63,9 @@ namespace BulletSharp
get
{
Vector3 value;
btHinge2Constraint_getAxis2(_native, out value);
btHinge2Constraint_getAxis2(Native, out value);
return value;
}
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHinge2Constraint_new(IntPtr rbA, IntPtr rbB, [In] ref Vector3 anchor, [In] ref Vector3 axis1, [In] ref Vector3 axis2);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHinge2Constraint_getAnchor(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHinge2Constraint_getAnchor2(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHinge2Constraint_getAngle1(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHinge2Constraint_getAngle2(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHinge2Constraint_getAxis1(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHinge2Constraint_getAxis2(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHinge2Constraint_setLowerLimit(IntPtr obj, float ang1min);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHinge2Constraint_setUpperLimit(IntPtr obj, float ang1max);
}
}

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -37,7 +37,7 @@ namespace BulletSharp
useReferenceFrameA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
_rigidBodyB = GetFixedBody();
}
public HingeConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB, Matrix rigidBodyAFrame,
@ -54,121 +54,121 @@ namespace BulletSharp
useReferenceFrameA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
_rigidBodyB = GetFixedBody();
}
public void EnableAngularMotor(bool enableMotor, float targetVelocity, float maxMotorImpulse)
{
btHingeConstraint_enableAngularMotor(_native, enableMotor, targetVelocity,
btHingeConstraint_enableAngularMotor(Native, enableMotor, targetVelocity,
maxMotorImpulse);
}
public float GetHingeAngleRef(ref Matrix transA, ref Matrix transB)
{
return btHingeConstraint_getHingeAngle(_native, ref transA, ref transB);
}
public float GetHingeAngleRef(ref Matrix transA, ref Matrix transB)
{
return btHingeConstraint_getHingeAngle(Native, ref transA, ref transB);
}
public float GetHingeAngle(Matrix transA, Matrix transB)
{
return btHingeConstraint_getHingeAngle(_native, ref transA, ref transB);
return btHingeConstraint_getHingeAngle(Native, ref transA, ref transB);
}
public void GetInfo1NonVirtual(ConstraintInfo1 info)
{
btHingeConstraint_getInfo1NonVirtual(_native, info._native);
btHingeConstraint_getInfo1NonVirtual(Native, info._native);
}
public void GetInfo2Internal(ConstraintInfo2 info, Matrix transA, Matrix transB,
Vector3 angVelA, Vector3 angVelB)
{
btHingeConstraint_getInfo2Internal(_native, info._native, ref transA,
btHingeConstraint_getInfo2Internal(Native, info._native, ref transA,
ref transB, ref angVelA, ref angVelB);
}
public void GetInfo2InternalUsingFrameOffset(ConstraintInfo2 info, Matrix transA,
Matrix transB, Vector3 angVelA, Vector3 angVelB)
{
btHingeConstraint_getInfo2InternalUsingFrameOffset(_native, info._native,
btHingeConstraint_getInfo2InternalUsingFrameOffset(Native, info._native,
ref transA, ref transB, ref angVelA, ref angVelB);
}
public void GetInfo2NonVirtual(ConstraintInfo2 info, Matrix transA, Matrix transB,
Vector3 angVelA, Vector3 angVelB)
{
btHingeConstraint_getInfo2NonVirtual(_native, info._native, ref transA,
btHingeConstraint_getInfo2NonVirtual(Native, info._native, ref transA,
ref transB, ref angVelA, ref angVelB);
}
public void SetAxisRef(ref Vector3 axisInA)
{
btHingeConstraint_setAxis(_native, ref axisInA);
}
public void SetAxisRef(ref Vector3 axisInA)
{
btHingeConstraint_setAxis(Native, ref axisInA);
}
public void SetAxis(Vector3 axisInA)
{
btHingeConstraint_setAxis(_native, ref axisInA);
btHingeConstraint_setAxis(Native, ref axisInA);
}
public void SetFramesRef(ref Matrix frameA, ref Matrix frameB)
{
btHingeConstraint_setFrames(_native, ref frameA, ref frameB);
}
public void SetFramesRef(ref Matrix frameA, ref Matrix frameB)
{
btHingeConstraint_setFrames(Native, ref frameA, ref frameB);
}
public void SetFrames(Matrix frameA, Matrix frameB)
{
btHingeConstraint_setFrames(_native, ref frameA, ref frameB);
btHingeConstraint_setFrames(Native, ref frameA, ref frameB);
}
public void SetLimit(float low, float high)
{
btHingeConstraint_setLimit(_native, low, high);
btHingeConstraint_setLimit(Native, low, high);
}
public void SetLimit(float low, float high, float softness)
{
btHingeConstraint_setLimit2(_native, low, high, softness);
btHingeConstraint_setLimit2(Native, low, high, softness);
}
public void SetLimit(float low, float high, float softness, float biasFactor)
{
btHingeConstraint_setLimit3(_native, low, high, softness, biasFactor);
btHingeConstraint_setLimit3(Native, low, high, softness, biasFactor);
}
public void SetLimit(float low, float high, float softness, float biasFactor,
float relaxationFactor)
{
btHingeConstraint_setLimit4(_native, low, high, softness, biasFactor,
btHingeConstraint_setLimit4(Native, low, high, softness, biasFactor,
relaxationFactor);
}
public void SetMotorTarget(float targetAngle, float deltaTime)
{
btHingeConstraint_setMotorTarget(_native, targetAngle, deltaTime);
btHingeConstraint_setMotorTarget(Native, targetAngle, deltaTime);
}
public void SetMotorTargetRef(ref Quaternion qAinB, float deltaTime)
{
btHingeConstraint_setMotorTarget2(_native, ref qAinB, deltaTime);
}
public void SetMotorTargetRef(ref Quaternion qAinB, float deltaTime)
{
btHingeConstraint_setMotorTarget2(Native, ref qAinB, deltaTime);
}
public void SetMotorTarget(Quaternion qAinB, float deltaTime)
{
btHingeConstraint_setMotorTarget2(_native, ref qAinB, deltaTime);
btHingeConstraint_setMotorTarget2(Native, ref qAinB, deltaTime);
}
public void TestLimitRef(ref Matrix transA, ref Matrix transB)
{
btHingeConstraint_testLimit(_native, ref transA, ref transB);
}
public void TestLimitRef(ref Matrix transA, ref Matrix transB)
{
btHingeConstraint_testLimit(Native, ref transA, ref transB);
}
public void TestLimit(Matrix transA, Matrix transB)
{
btHingeConstraint_testLimit(_native, ref transA, ref transB);
btHingeConstraint_testLimit(Native, ref transA, ref transB);
}
public void UpdateRhs(float timeStep)
{
btHingeConstraint_updateRHS(_native, timeStep);
btHingeConstraint_updateRHS(Native, timeStep);
}
public Matrix AFrame
@ -176,15 +176,15 @@ namespace BulletSharp
get
{
Matrix value;
btHingeConstraint_getAFrame(_native, out value);
btHingeConstraint_getAFrame(Native, out value);
return value;
}
}
public bool AngularOnly
{
get { return btHingeConstraint_getAngularOnly(_native); }
set { btHingeConstraint_setAngularOnly(_native, value); }
get => btHingeConstraint_getAngularOnly(Native);
set => btHingeConstraint_setAngularOnly(Native, value);
}
public Matrix BFrame
@ -192,28 +192,25 @@ namespace BulletSharp
get
{
Matrix value;
btHingeConstraint_getBFrame(_native, out value);
btHingeConstraint_getBFrame(Native, out value);
return value;
}
}
public bool EnableMotor
public bool EnableMotor
{
get { return btHingeConstraint_getEnableAngularMotor(_native); }
set { btHingeConstraint_enableMotor(_native, value); }
get => btHingeConstraint_getEnableAngularMotor(Native);
set => btHingeConstraint_enableMotor(Native, value);
}
public HingeFlags Flags
{
get { return btHingeConstraint_getFlags(_native); }
}
public HingeFlags Flags => btHingeConstraint_getFlags(Native);
public Matrix FrameOffsetA
{
get
{
Matrix value;
btHingeConstraint_getFrameOffsetA(_native, out value);
btHingeConstraint_getFrameOffsetA(Native, out value);
return value;
}
}
@ -223,176 +220,48 @@ namespace BulletSharp
get
{
Matrix value;
btHingeConstraint_getFrameOffsetB(_native, out value);
btHingeConstraint_getFrameOffsetB(Native, out value);
return value;
}
}
public bool HasLimit
{
get { return btHingeConstraint_hasLimit(_native); }
}
public bool HasLimit => btHingeConstraint_hasLimit(Native);
public float HingeAngle
{
get { return btHingeConstraint_getHingeAngle2(_native); }
}
public float HingeAngle => btHingeConstraint_getHingeAngle2(Native);
public float LimitBiasFactor
{
get { return btHingeConstraint_getLimitBiasFactor(_native); }
}
public float LimitBiasFactor => btHingeConstraint_getLimitBiasFactor(Native);
public float LimitRelaxationFactor
{
get { return btHingeConstraint_getLimitRelaxationFactor(_native); }
}
public float LimitRelaxationFactor => btHingeConstraint_getLimitRelaxationFactor(Native);
public float LimitSign
{
get { return btHingeConstraint_getLimitSign(_native); }
}
public float LimitSign => btHingeConstraint_getLimitSign(Native);
public float LimitSoftness
{
get { return btHingeConstraint_getLimitSoftness(_native); }
}
public float LimitSoftness => btHingeConstraint_getLimitSoftness(Native);
public float LowerLimit
{
get { return btHingeConstraint_getLowerLimit(_native); }
}
public float LowerLimit => btHingeConstraint_getLowerLimit(Native);
public float MaxMotorImpulse
{
get { return btHingeConstraint_getMaxMotorImpulse(_native); }
set { btHingeConstraint_setMaxMotorImpulse(_native, value); }
get => btHingeConstraint_getMaxMotorImpulse(Native);
set => btHingeConstraint_setMaxMotorImpulse(Native, value);
}
public float MotorTargetVelocity
{
get { return btHingeConstraint_getMotorTargetVelocity(_native); }
}
public float MotorTargetVelocity => btHingeConstraint_getMotorTargetVelocity(Native);
public int SolveLimit
{
get { return btHingeConstraint_getSolveLimit(_native); }
}
public int SolveLimit => btHingeConstraint_getSolveLimit(Native);
public float UpperLimit
{
get { return btHingeConstraint_getUpperLimit(_native); }
}
public float UpperLimit => btHingeConstraint_getUpperLimit(Native);
public bool UseFrameOffset
{
get { return btHingeConstraint_getUseFrameOffset(_native); }
set { btHingeConstraint_setUseFrameOffset(_native, value); }
get => btHingeConstraint_getUseFrameOffset(Native);
set => btHingeConstraint_setUseFrameOffset(Native, value);
}
public bool UseReferenceFrameA
{
get { return btHingeConstraint_getUseReferenceFrameA(_native); }
set { btHingeConstraint_setUseReferenceFrameA(_native, value); }
get => btHingeConstraint_getUseReferenceFrameA(Native);
set => btHingeConstraint_setUseReferenceFrameA(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Vector3 pivotInA, [In] ref Vector3 pivotInB, [In] ref Vector3 axisInA, [In] ref Vector3 axisInB, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeConstraint_new2(IntPtr rbA, [In] ref Vector3 pivotInA, [In] ref Vector3 axisInA, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeConstraint_new3(IntPtr rbA, IntPtr rbB, [In] ref Matrix rbAFrame, [In] ref Matrix rbBFrame, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeConstraint_new4(IntPtr rbA, [In] ref Matrix rbAFrame, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_enableAngularMotor(IntPtr obj, bool enableMotor, float targetVelocity, float maxMotorImpulse);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_enableMotor(IntPtr obj, bool enableMotor);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getAFrame(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btHingeConstraint_getAngularOnly(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getBFrame(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btHingeConstraint_getEnableAngularMotor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern HingeFlags btHingeConstraint_getFlags(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getFrameOffsetA(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getFrameOffsetB(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getHingeAngle(IntPtr obj, [In] ref Matrix transA, [In] ref Matrix transB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getHingeAngle2(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getInfo1NonVirtual(IntPtr obj, IntPtr info);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getInfo2Internal(IntPtr obj, IntPtr info, [In] ref Matrix transA, [In] ref Matrix transB, [In] ref Vector3 angVelA, [In] ref Vector3 angVelB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getInfo2InternalUsingFrameOffset(IntPtr obj, IntPtr info, [In] ref Matrix transA, [In] ref Matrix transB, [In] ref Vector3 angVelA, [In] ref Vector3 angVelB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_getInfo2NonVirtual(IntPtr obj, IntPtr info, [In] ref Matrix transA, [In] ref Matrix transB, [In] ref Vector3 angVelA, [In] ref Vector3 angVelB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getLimitBiasFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getLimitRelaxationFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getLimitSign(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getLimitSoftness(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getLowerLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getMaxMotorImpulse(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getMotorTargetVelocity(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btHingeConstraint_getSolveLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeConstraint_getUpperLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btHingeConstraint_getUseFrameOffset(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btHingeConstraint_getUseReferenceFrameA(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btHingeConstraint_hasLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setAngularOnly(IntPtr obj, bool angularOnly);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setAxis(IntPtr obj, [In] ref Vector3 axisInA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setFrames(IntPtr obj, [In] ref Matrix frameA, [In] ref Matrix frameB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setLimit(IntPtr obj, float low, float high);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setLimit2(IntPtr obj, float low, float high, float _softness);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setLimit3(IntPtr obj, float low, float high, float _softness, float _biasFactor);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setLimit4(IntPtr obj, float low, float high, float _softness, float _biasFactor, float _relaxationFactor);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setMaxMotorImpulse(IntPtr obj, float maxMotorImpulse);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setMotorTarget(IntPtr obj, float targetAngle, float dt);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setMotorTarget2(IntPtr obj, [In] ref Quaternion qAinB, float dt);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setMotorTargetVelocity(IntPtr obj, float motorTargetVelocity);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setUseFrameOffset(IntPtr obj, bool frameOffsetOnOff);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_setUseReferenceFrameA(IntPtr obj, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_testLimit(IntPtr obj, [In] ref Matrix transA, [In] ref Matrix transB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeConstraint_updateRHS(IntPtr obj, float timeStep);
}
public class HingeAccumulatedAngleConstraint : HingeConstraint
@ -412,7 +281,7 @@ namespace BulletSharp
ref axisInA, useReferenceFrameA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
_rigidBodyB = GetFixedBody();
}
public HingeAccumulatedAngleConstraint(RigidBody rigidBodyA, RigidBody rigidBodyB,
@ -430,46 +299,33 @@ namespace BulletSharp
useReferenceFrameA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
_rigidBodyB = GetFixedBody();
}
public float AccumulatedHingeAngle
{
get { return btHingeAccumulatedAngleConstraint_getAccumulatedHingeAngle(_native); }
set { btHingeAccumulatedAngleConstraint_setAccumulatedHingeAngle(_native, value); }
get => btHingeAccumulatedAngleConstraint_getAccumulatedHingeAngle(Native);
set => btHingeAccumulatedAngleConstraint_setAccumulatedHingeAngle(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeAccumulatedAngleConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Vector3 pivotInA, [In] ref Vector3 pivotInB, [In] ref Vector3 axisInA, [In] ref Vector3 axisInB, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeAccumulatedAngleConstraint_new2(IntPtr rbA, [In] ref Vector3 pivotInA, [In] ref Vector3 axisInA, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeAccumulatedAngleConstraint_new3(IntPtr rbA, IntPtr rbB, [In] ref Matrix rbAFrame, [In] ref Matrix rbBFrame, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btHingeAccumulatedAngleConstraint_new4(IntPtr rbA, [In] ref Matrix rbAFrame, bool useReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btHingeAccumulatedAngleConstraint_getAccumulatedHingeAngle(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btHingeAccumulatedAngleConstraint_setAccumulatedHingeAngle(IntPtr obj, float accAngle);
}
[StructLayout(LayoutKind.Sequential)]
internal struct HingeConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public TransformFloatData RigidBodyAFrame;
public TransformFloatData RigidBodyBFrame;
public int UseReferenceFrameA;
public int AngularOnly;
public int EnableAngularMotor;
public float MotorTargetVelocity;
public float MaxMotorImpulse;
public float LowerLimit;
public float UpperLimit;
public float LimitSoftness;
public float BiasFactor;
public float RelaxationFactor;
[StructLayout(LayoutKind.Sequential)]
internal struct HingeConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public TransformFloatData RigidBodyAFrame;
public TransformFloatData RigidBodyBFrame;
public int UseReferenceFrameA;
public int AngularOnly;
public int EnableAngularMotor;
public float MotorTargetVelocity;
public float MaxMotorImpulse;
public float LowerLimit;
public float UpperLimit;
public float LimitSoftness;
public float BiasFactor;
public float RelaxationFactor;
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(HingeConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(HingeConstraintFloatData), fieldName).ToInt32(); }
}
}

Просмотреть файл

@ -1,51 +1,52 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
public interface IAction
{
void DebugDraw(IDebugDraw debugDrawer);
void UpdateAction(CollisionWorld collisionWorld, float deltaTimeStep);
}
public interface IAction
{
void DebugDraw(IDebugDraw debugDrawer);
void UpdateAction(CollisionWorld collisionWorld, float deltaTimeStep);
}
internal class ActionInterfaceWrapper : IDisposable
internal class ActionInterfaceWrapper : IDisposable
{
internal IntPtr _native;
IAction _actionInterface;
DynamicsWorld _world;
private IAction _actionInterface;
private DynamicsWorld _world;
[UnmanagedFunctionPointerAttribute(Native.Conv), SuppressUnmanagedCodeSecurity]
delegate void DebugDrawUnmanagedDelegate(IntPtr debugDrawer);
[UnmanagedFunctionPointerAttribute(Native.Conv), SuppressUnmanagedCodeSecurity]
delegate void UpdateActionUnmanagedDelegate(IntPtr collisionWorld, float deltaTimeStep);
[UnmanagedFunctionPointer(Native.Conv), SuppressUnmanagedCodeSecurity]
private delegate void DebugDrawUnmanagedDelegate(IntPtr debugDrawer);
[UnmanagedFunctionPointer(Native.Conv), SuppressUnmanagedCodeSecurity]
private delegate void UpdateActionUnmanagedDelegate(IntPtr collisionWorld, float deltaTimeStep);
DebugDrawUnmanagedDelegate _debugDraw;
UpdateActionUnmanagedDelegate _updateAction;
private DebugDrawUnmanagedDelegate _debugDraw;
private UpdateActionUnmanagedDelegate _updateAction;
public ActionInterfaceWrapper(IAction actionInterface, DynamicsWorld world)
{
_actionInterface = actionInterface;
_world = world;
public ActionInterfaceWrapper(IAction actionInterface, DynamicsWorld world)
{
_actionInterface = actionInterface;
_world = world;
_debugDraw = new DebugDrawUnmanagedDelegate(DebugDrawUnmanaged);
_updateAction = new UpdateActionUnmanagedDelegate(UpdateActionUnmanaged);
_debugDraw = new DebugDrawUnmanagedDelegate(DebugDrawUnmanaged);
_updateAction = new UpdateActionUnmanagedDelegate(UpdateActionUnmanaged);
_native = btActionInterfaceWrapper_new(
Marshal.GetFunctionPointerForDelegate(_debugDraw),
Marshal.GetFunctionPointerForDelegate(_updateAction));
}
_native = btActionInterfaceWrapper_new(
Marshal.GetFunctionPointerForDelegate(_debugDraw),
Marshal.GetFunctionPointerForDelegate(_updateAction));
}
private void DebugDrawUnmanaged(IntPtr debugDrawer)
{
_actionInterface.DebugDraw(DebugDraw.GetManaged(debugDrawer));
}
private void DebugDrawUnmanaged(IntPtr debugDrawer)
{
_actionInterface.DebugDraw(DebugDraw.GetManaged(debugDrawer));
}
private void UpdateActionUnmanaged(IntPtr collisionWorld, float deltaTimeStep)
{
_actionInterface.UpdateAction(_world, deltaTimeStep);
}
private void UpdateActionUnmanaged(IntPtr collisionWorld, float deltaTimeStep)
{
_actionInterface.UpdateAction(_world, deltaTimeStep);
}
public void Dispose()
{
@ -66,10 +67,5 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btActionInterfaceWrapper_new(IntPtr debugDrawCallback, IntPtr updateActionCallback);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btActionInterface_delete(IntPtr obj);
}
}
}

Просмотреть файл

@ -1,38 +1,27 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
public class MlcpSolver : SequentialImpulseConstraintSolver
{
private MlcpSolverInterface _mlcpSolver;
private MlcpSolverInterface _mlcpSolver;
public MlcpSolver(MlcpSolverInterface solver)
: base(btMLCPSolver_new(solver._native), false)
: base(btMLCPSolver_new(solver.Native), false)
{
_mlcpSolver = solver;
_mlcpSolver = solver;
}
public void SetMLCPSolver(MlcpSolverInterface solver)
{
btMLCPSolver_setMLCPSolver(_native, solver._native);
_mlcpSolver = solver;
btMLCPSolver_setMLCPSolver(Native, solver.Native);
_mlcpSolver = solver;
}
public int NumFallbacks
{
get { return btMLCPSolver_getNumFallbacks(_native); }
set { btMLCPSolver_setNumFallbacks(_native, value); }
get => btMLCPSolver_getNumFallbacks(Native);
set => btMLCPSolver_setNumFallbacks(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btMLCPSolver_new(IntPtr solver);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btMLCPSolver_getNumFallbacks(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btMLCPSolver_setMLCPSolver(IntPtr obj, IntPtr solver);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btMLCPSolver_setNumFallbacks(IntPtr obj, int num);
}
}

Просмотреть файл

@ -1,27 +1,26 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
public abstract class MlcpSolverInterface : IDisposable
{
internal IntPtr _native;
internal IntPtr Native;
internal MlcpSolverInterface(IntPtr native)
{
_native = native;
Native = native;
}
/*
/*
public bool SolveMLCP(btMatrixX<float> a, btVectorX<float> b, btVectorX<float> x,
btVectorX<float> lo, btVectorX<float> hi, AlignedObjectArray<int> limitDependency,
int numIterations, bool useSparsity = true)
{
return btMLCPSolverInterface_solveMLCP(_native, a._native, b._native,
x._native, lo._native, hi._native, limitDependency._native, numIterations,
return btMLCPSolverInterface_solveMLCP(Native, a.Native, b.Native,
x.Native, lo.Native, hi.Native, limitDependency.Native, numIterations,
useSparsity);
}
*/
*/
public void Dispose()
{
Dispose(true);
@ -30,10 +29,10 @@ namespace BulletSharp
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
if (Native != IntPtr.Zero)
{
btMLCPSolverInterface_delete(_native);
_native = IntPtr.Zero;
btMLCPSolverInterface_delete(Native);
Native = IntPtr.Zero;
}
}
@ -41,11 +40,5 @@ namespace BulletSharp
{
Dispose(false);
}
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//[return: MarshalAs(UnmanagedType.I1)]
//static extern bool btMLCPSolverInterface_solveMLCP(IntPtr obj, IntPtr A, IntPtr b, IntPtr x, IntPtr lo, IntPtr hi, IntPtr limitDependency, int numIterations, bool useSparsity);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btMLCPSolverInterface_delete(IntPtr obj);
}
}

Просмотреть файл

@ -1,6 +1,4 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -13,16 +11,8 @@ namespace BulletSharp
public bool OnlyForNoneContact
{
get { return btNNCGConstraintSolver_getOnlyForNoneContact(_native); }
set { btNNCGConstraintSolver_setOnlyForNoneContact(_native, value); }
get => btNNCGConstraintSolver_getOnlyForNoneContact(Native);
set => btNNCGConstraintSolver_setOnlyForNoneContact(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btNNCGConstraintSolver_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btNNCGConstraintSolver_getOnlyForNoneContact(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btNNCGConstraintSolver_setOnlyForNoneContact(IntPtr obj, bool value);
}
}

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -15,47 +15,30 @@ namespace BulletSharp
public class ConstraintSetting
{
internal IntPtr _native;
internal IntPtr Native;
internal ConstraintSetting(IntPtr native)
{
_native = native;
Native = native;
}
public float Damping
{
get { return btConstraintSetting_getDamping(_native); }
set { btConstraintSetting_setDamping(_native, value); }
get => btConstraintSetting_getDamping(Native);
set => btConstraintSetting_setDamping(Native, value);
}
public float ImpulseClamp
{
get { return btConstraintSetting_getImpulseClamp(_native); }
set { btConstraintSetting_setImpulseClamp(_native, value); }
get => btConstraintSetting_getImpulseClamp(Native);
set => btConstraintSetting_setImpulseClamp(Native, value);
}
public float Tau
{
get { return btConstraintSetting_getTau(_native); }
set { btConstraintSetting_setTau(_native, value); }
get => btConstraintSetting_getTau(Native);
set => btConstraintSetting_setTau(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btConstraintSetting_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConstraintSetting_getDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConstraintSetting_getImpulseClamp(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btConstraintSetting_getTau(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSetting_setDamping(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSetting_setImpulseClamp(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSetting_setTau(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btConstraintSetting_delete(IntPtr obj);
}
public class Point2PointConstraint : TypedConstraint
@ -73,39 +56,36 @@ namespace BulletSharp
: base(btPoint2PointConstraint_new2(rigidBodyA.Native, ref pivotInA))
{
_rigidBodyA = rigidBodyA;
_rigidBodyB = GetFixedBody();
_rigidBodyB = GetFixedBody();
}
public void GetInfo1NonVirtual(ConstraintInfo1 info)
{
btPoint2PointConstraint_getInfo1NonVirtual(_native, info._native);
btPoint2PointConstraint_getInfo1NonVirtual(Native, info._native);
}
public void GetInfo2NonVirtual(ConstraintInfo2 info, Matrix body0Trans, Matrix body1Trans)
{
btPoint2PointConstraint_getInfo2NonVirtual(_native, info._native, ref body0Trans,
btPoint2PointConstraint_getInfo2NonVirtual(Native, info._native, ref body0Trans,
ref body1Trans);
}
public void UpdateRhs(float timeStep)
{
btPoint2PointConstraint_updateRHS(_native, timeStep);
btPoint2PointConstraint_updateRHS(Native, timeStep);
}
public Point2PointFlags Flags
{
get { return btPoint2PointConstraint_getFlags(_native); }
}
public Point2PointFlags Flags => btPoint2PointConstraint_getFlags(Native);
public Vector3 PivotInA
{
get
{
Vector3 value;
btPoint2PointConstraint_getPivotInA(_native, out value);
btPoint2PointConstraint_getPivotInA(Native, out value);
return value;
}
set { btPoint2PointConstraint_setPivotA(_native, ref value); }
set => btPoint2PointConstraint_setPivotA(Native, ref value);
}
public Vector3 PivotInB
@ -113,59 +93,28 @@ namespace BulletSharp
get
{
Vector3 value;
btPoint2PointConstraint_getPivotInB(_native, out value);
btPoint2PointConstraint_getPivotInB(Native, out value);
return value;
}
set { btPoint2PointConstraint_setPivotB(_native, ref value); }
set => btPoint2PointConstraint_setPivotB(Native, ref value);
}
public ConstraintSetting Setting
{
get { return new ConstraintSetting(btPoint2PointConstraint_getSetting(_native)); }
}
public ConstraintSetting Setting => new ConstraintSetting(btPoint2PointConstraint_getSetting(Native));
public bool UseSolveConstraintObsolete
{
get { return btPoint2PointConstraint_getUseSolveConstraintObsolete(_native); }
set { btPoint2PointConstraint_setUseSolveConstraintObsolete(_native, value); }
get => btPoint2PointConstraint_getUseSolveConstraintObsolete(Native);
set => btPoint2PointConstraint_setUseSolveConstraintObsolete(Native, value);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btPoint2PointConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Vector3 pivotInA, [In] ref Vector3 pivotInB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btPoint2PointConstraint_new2(IntPtr rbA, [In] ref Vector3 pivotInA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern Point2PointFlags btPoint2PointConstraint_getFlags(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_getInfo1NonVirtual(IntPtr obj, IntPtr info);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_getInfo2NonVirtual(IntPtr obj, IntPtr info, [In] ref Matrix body0_trans, [In] ref Matrix body1_trans);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_getPivotInA(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_getPivotInB(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btPoint2PointConstraint_getSetting(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btPoint2PointConstraint_getUseSolveConstraintObsolete(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_setPivotA(IntPtr obj, [In] ref Vector3 pivotA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_setPivotB(IntPtr obj, [In] ref Vector3 pivotB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_setUseSolveConstraintObsolete(IntPtr obj, bool value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btPoint2PointConstraint_updateRHS(IntPtr obj, float timeStep);
}
[StructLayout(LayoutKind.Sequential)]
internal struct Point2PointConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public Vector3FloatData PivotInA;
public Vector3FloatData PivotInB;
[StructLayout(LayoutKind.Sequential)]
internal struct Point2PointConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public Vector3FloatData PivotInA;
public Vector3FloatData PivotInB;
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(Point2PointConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(Point2PointConstraintFloatData), fieldName).ToInt32(); }
}
}

Просмотреть файл

@ -23,7 +23,7 @@ namespace BulletSharp
internal List<TypedConstraint> _constraintRefs;
public RigidBody(RigidBodyConstructionInfo constructionInfo)
: base(btRigidBody_new(constructionInfo._native))
: base(btRigidBody_new(constructionInfo.Native))
{
_collisionShape = constructionInfo.CollisionShape;
_motionState = constructionInfo.MotionState;
@ -36,7 +36,7 @@ namespace BulletSharp
_constraintRefs = new List<TypedConstraint>();
}
_constraintRefs.Add(constraint);
btRigidBody_addConstraintRef(Native, constraint._native);
btRigidBody_addConstraintRef(Native, constraint.Native);
}
public void ApplyCentralForceRef(ref Vector3 force)
@ -200,7 +200,7 @@ namespace BulletSharp
if (_constraintRefs != null)
{
_constraintRefs.Remove(constraint);
btRigidBody_removeConstraintRef(Native, constraint._native);
btRigidBody_removeConstraintRef(Native, constraint.Native);
}
}

Просмотреть файл

@ -1,13 +1,12 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
public class RigidBodyConstructionInfo : IDisposable
{
internal IntPtr _native;
internal IntPtr Native;
private CollisionShape _collisionShape;
private MotionState _motionState;
@ -15,7 +14,7 @@ namespace BulletSharp
public RigidBodyConstructionInfo(float mass, MotionState motionState,
CollisionShape collisionShape)
{
_native = btRigidBody_btRigidBodyConstructionInfo_new(mass, motionState != null ? motionState._native : IntPtr.Zero,
Native = btRigidBody_btRigidBodyConstructionInfo_new(mass, motionState != null ? motionState._native : IntPtr.Zero,
collisionShape != null ? collisionShape.Native : IntPtr.Zero);
_collisionShape = collisionShape;
_motionState = motionState;
@ -24,7 +23,7 @@ namespace BulletSharp
public RigidBodyConstructionInfo(float mass, MotionState motionState,
CollisionShape collisionShape, Vector3 localInertia)
{
_native = btRigidBody_btRigidBodyConstructionInfo_new2(mass, motionState != null ? motionState._native : IntPtr.Zero,
Native = btRigidBody_btRigidBodyConstructionInfo_new2(mass, motionState != null ? motionState._native : IntPtr.Zero,
collisionShape != null ? collisionShape.Native : IntPtr.Zero, ref localInertia);
_collisionShape = collisionShape;
_motionState = motionState;
@ -32,72 +31,72 @@ namespace BulletSharp
public float AdditionalAngularDampingFactor
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAdditionalAngularDampingFactor(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAdditionalAngularDampingFactor(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAdditionalAngularDampingFactor(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAdditionalAngularDampingFactor(Native, value);
}
public float AdditionalAngularDampingThresholdSqr
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAdditionalAngularDampingThresholdSqr(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAdditionalAngularDampingThresholdSqr(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAdditionalAngularDampingThresholdSqr(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAdditionalAngularDampingThresholdSqr(Native, value);
}
public bool AdditionalDamping
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAdditionalDamping(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAdditionalDamping(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAdditionalDamping(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAdditionalDamping(Native, value);
}
public float AdditionalDampingFactor
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAdditionalDampingFactor(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAdditionalDampingFactor(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAdditionalDampingFactor(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAdditionalDampingFactor(Native, value);
}
public float AdditionalLinearDampingThresholdSqr
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAdditionalLinearDampingThresholdSqr(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAdditionalLinearDampingThresholdSqr(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAdditionalLinearDampingThresholdSqr(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAdditionalLinearDampingThresholdSqr(Native, value);
}
public float AngularDamping
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAngularDamping(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAngularDamping(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAngularDamping(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAngularDamping(Native, value);
}
public float AngularSleepingThreshold
{
get { return btRigidBody_btRigidBodyConstructionInfo_getAngularSleepingThreshold(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setAngularSleepingThreshold(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getAngularSleepingThreshold(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setAngularSleepingThreshold(Native, value);
}
public CollisionShape CollisionShape
{
get { return _collisionShape; }
get => _collisionShape;
set
{
btRigidBody_btRigidBodyConstructionInfo_setCollisionShape(_native, value != null ? value.Native : IntPtr.Zero);
btRigidBody_btRigidBodyConstructionInfo_setCollisionShape(Native, value != null ? value.Native : IntPtr.Zero);
_collisionShape = value;
}
}
public float Friction
{
get { return btRigidBody_btRigidBodyConstructionInfo_getFriction(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setFriction(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getFriction(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setFriction(Native, value);
}
public float LinearDamping
{
get { return btRigidBody_btRigidBodyConstructionInfo_getLinearDamping(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setLinearDamping(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getLinearDamping(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setLinearDamping(Native, value);
}
public float LinearSleepingThreshold
{
get { return btRigidBody_btRigidBodyConstructionInfo_getLinearSleepingThreshold(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setLinearSleepingThreshold(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getLinearSleepingThreshold(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setLinearSleepingThreshold(Native, value);
}
public Vector3 LocalInertia
@ -105,38 +104,38 @@ namespace BulletSharp
get
{
Vector3 value;
btRigidBody_btRigidBodyConstructionInfo_getLocalInertia(_native, out value);
btRigidBody_btRigidBodyConstructionInfo_getLocalInertia(Native, out value);
return value;
}
set { btRigidBody_btRigidBodyConstructionInfo_setLocalInertia(_native, ref value); }
set => btRigidBody_btRigidBodyConstructionInfo_setLocalInertia(Native, ref value);
}
public float Mass
{
get { return btRigidBody_btRigidBodyConstructionInfo_getMass(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setMass(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getMass(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setMass(Native, value);
}
public MotionState MotionState
{
get { return _motionState; }
get => _motionState;
set
{
btRigidBody_btRigidBodyConstructionInfo_setMotionState(_native, value != null ? value._native : IntPtr.Zero);
btRigidBody_btRigidBodyConstructionInfo_setMotionState(Native, value != null ? value._native : IntPtr.Zero);
_motionState = value;
}
}
public float Restitution
{
get { return btRigidBody_btRigidBodyConstructionInfo_getRestitution(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setRestitution(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getRestitution(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setRestitution(Native, value);
}
public float RollingFriction
{
get { return btRigidBody_btRigidBodyConstructionInfo_getRollingFriction(_native); }
set { btRigidBody_btRigidBodyConstructionInfo_setRollingFriction(_native, value); }
get => btRigidBody_btRigidBodyConstructionInfo_getRollingFriction(Native);
set => btRigidBody_btRigidBodyConstructionInfo_setRollingFriction(Native, value);
}
public Matrix StartWorldTransform
@ -144,10 +143,10 @@ namespace BulletSharp
get
{
Matrix value;
btRigidBody_btRigidBodyConstructionInfo_getStartWorldTransform(_native, out value);
btRigidBody_btRigidBodyConstructionInfo_getStartWorldTransform(Native, out value);
return value;
}
set { btRigidBody_btRigidBodyConstructionInfo_setStartWorldTransform(_native, ref value); }
set => btRigidBody_btRigidBodyConstructionInfo_setStartWorldTransform(Native, ref value);
}
public void Dispose()
@ -158,10 +157,10 @@ namespace BulletSharp
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
if (Native != IntPtr.Zero)
{
btRigidBody_btRigidBodyConstructionInfo_delete(_native);
_native = IntPtr.Zero;
btRigidBody_btRigidBodyConstructionInfo_delete(Native);
Native = IntPtr.Zero;
}
}
@ -169,77 +168,5 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btRigidBody_btRigidBodyConstructionInfo_new(float mass, IntPtr motionState, IntPtr collisionShape);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btRigidBody_btRigidBodyConstructionInfo_new2(float mass, IntPtr motionState, IntPtr collisionShape, [In] ref Vector3 localInertia);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getAdditionalAngularDampingFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getAdditionalAngularDampingThresholdSqr(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btRigidBody_btRigidBodyConstructionInfo_getAdditionalDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getAdditionalDampingFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getAdditionalLinearDampingThresholdSqr(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getAngularDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getAngularSleepingThreshold(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getFriction(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getLinearDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getLinearSleepingThreshold(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_getLocalInertia(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getMass(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getRestitution(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btRigidBody_btRigidBodyConstructionInfo_getRollingFriction(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_getStartWorldTransform(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAdditionalAngularDampingFactor(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAdditionalAngularDampingThresholdSqr(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAdditionalDamping(IntPtr obj, bool value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAdditionalDampingFactor(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAdditionalLinearDampingThresholdSqr(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAngularDamping(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setAngularSleepingThreshold(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setCollisionShape(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setFriction(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setLinearDamping(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setLinearSleepingThreshold(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setLocalInertia(IntPtr obj, [In] ref Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setMass(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setMotionState(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setRestitution(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setRollingFriction(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_setStartWorldTransform(IntPtr obj, [In] ref Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btRigidBody_btRigidBodyConstructionInfo_delete(IntPtr obj);
}
}
}

Просмотреть файл

@ -1,6 +1,5 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -18,110 +17,80 @@ namespace BulletSharp
public ulong BtRand2()
{
return btSequentialImpulseConstraintSolver_btRand2(_native);
return btSequentialImpulseConstraintSolver_btRand2(Native);
}
public int BtRandInt2(int n)
{
return btSequentialImpulseConstraintSolver_btRandInt2(_native, n);
return btSequentialImpulseConstraintSolver_btRandInt2(Native, n);
}
/*
public void SetConstraintRowSolverGeneric(SingleConstraintRowSolver rowSolver)
{
btSequentialImpulseConstraintSolver_setConstraintRowSolverGeneric(_native,
rowSolver._native);
btSequentialImpulseConstraintSolver_setConstraintRowSolverGeneric(Native,
rowSolver.Native);
}
public void SetConstraintRowSolverLowerLimit(SingleConstraintRowSolver rowSolver)
{
btSequentialImpulseConstraintSolver_setConstraintRowSolverLowerLimit(
_native, rowSolver._native);
Native, rowSolver.Native);
}
public float SolveGroup(CollisionObject bodies, int numBodies, PersistentManifold manifold,
int numManifolds, TypedConstraint constraints, int numConstraints, ContactSolverInfo info,
IDebugDraw debugDrawer, Dispatcher dispatcher)
{
return btSequentialImpulseConstraintSolver_solveGroup(_native, bodies._native,
numBodies, manifold._native, numManifolds, constraints._native, numConstraints,
info._native, DebugDraw.GetUnmanaged(debugDrawer), dispatcher._native);
return btSequentialImpulseConstraintSolver_solveGroup(Native, bodies.Native,
numBodies, manifold.Native, numManifolds, constraints.Native, numConstraints,
info.Native, DebugDraw.GetUnmanaged(debugDrawer), dispatcher.Native);
}
public SingleConstraintRowSolver ActiveConstraintRowSolverGeneric
{
get { return btSequentialImpulseConstraintSolver_getActiveConstraintRowSolverGeneric(_native); }
get { return btSequentialImpulseConstraintSolver_getActiveConstraintRowSolverGeneric(Native); }
}
public SingleConstraintRowSolver ActiveConstraintRowSolverLowerLimit
{
get { return btSequentialImpulseConstraintSolver_getActiveConstraintRowSolverLowerLimit(_native); }
get { return btSequentialImpulseConstraintSolver_getActiveConstraintRowSolverLowerLimit(Native); }
}
*/
public ulong RandSeed
{
get { return btSequentialImpulseConstraintSolver_getRandSeed(_native); }
set { btSequentialImpulseConstraintSolver_setRandSeed(_native, value); }
get => btSequentialImpulseConstraintSolver_getRandSeed(Native);
set => btSequentialImpulseConstraintSolver_setRandSeed(Native, value);
}
/*
public SingleConstraintRowSolver ScalarConstraintRowSolverGeneric
{
get { return btSequentialImpulseConstraintSolver_getScalarConstraintRowSolverGeneric(_native); }
get { return btSequentialImpulseConstraintSolver_getScalarConstraintRowSolverGeneric(Native); }
}
public SingleConstraintRowSolver ScalarConstraintRowSolverLowerLimit
{
get { return btSequentialImpulseConstraintSolver_getScalarConstraintRowSolverLowerLimit(_native); }
get { return btSequentialImpulseConstraintSolver_getScalarConstraintRowSolverLowerLimit(Native); }
}
public SingleConstraintRowSolver SSE2ConstraintRowSolverGeneric
{
get { return btSequentialImpulseConstraintSolver_getSSE2ConstraintRowSolverGeneric(_native); }
get { return btSequentialImpulseConstraintSolver_getSSE2ConstraintRowSolverGeneric(Native); }
}
public SingleConstraintRowSolver SSE2ConstraintRowSolverLowerLimit
{
get { return btSequentialImpulseConstraintSolver_getSSE2ConstraintRowSolverLowerLimit(_native); }
get { return btSequentialImpulseConstraintSolver_getSSE2ConstraintRowSolverLowerLimit(Native); }
}
public SingleConstraintRowSolver SSE41ConstraintRowSolverGeneric
{
get { return btSequentialImpulseConstraintSolver_getSSE4_1ConstraintRowSolverGeneric(_native); }
get { return btSequentialImpulseConstraintSolver_getSSE4_1ConstraintRowSolverGeneric(Native); }
}
public SingleConstraintRowSolver SSE41ConstraintRowSolverLowerLimit
{
get { return btSequentialImpulseConstraintSolver_getSSE4_1ConstraintRowSolverLowerLimit(_native); }
get { return btSequentialImpulseConstraintSolver_getSSE4_1ConstraintRowSolverLowerLimit(Native); }
}
*/
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btSequentialImpulseConstraintSolver_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern ulong btSequentialImpulseConstraintSolver_btRand2(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btSequentialImpulseConstraintSolver_btRandInt2(IntPtr obj, int n);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getActiveConstraintRowSolverGeneric(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getActiveConstraintRowSolverLowerLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern ulong btSequentialImpulseConstraintSolver_getRandSeed(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getScalarConstraintRowSolverGeneric(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getScalarConstraintRowSolverLowerLimit(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getSSE2ConstraintRowSolverGeneric(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getSSE2ConstraintRowSolverLowerLimit(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getSSE4_1ConstraintRowSolverGeneric(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btSequentialImpulseConstraintSolver_getSSE4_1ConstraintRowSolverLowerLimit(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern void btSequentialImpulseConstraintSolver_setConstraintRowSolverGeneric(IntPtr obj, IntPtr rowSolver);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern void btSequentialImpulseConstraintSolver_setConstraintRowSolverLowerLimit(IntPtr obj, IntPtr rowSolver);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSequentialImpulseConstraintSolver_setRandSeed(IntPtr obj, ulong seed);
}
}

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -37,50 +37,50 @@ namespace BulletSharp
public SliderConstraint(RigidBody rigidBodyB, Matrix frameInB, bool useLinearReferenceFrameA)
: base(btSliderConstraint_new2(rigidBodyB.Native, ref frameInB, useLinearReferenceFrameA))
{
_rigidBodyA = GetFixedBody();
_rigidBodyA = GetFixedBody();
_rigidBodyB = rigidBodyB;
}
public void CalculateTransformsRef(ref Matrix transA, ref Matrix transB)
{
btSliderConstraint_calculateTransforms(_native, ref transA, ref transB);
}
public void CalculateTransformsRef(ref Matrix transA, ref Matrix transB)
{
btSliderConstraint_calculateTransforms(Native, ref transA, ref transB);
}
public void CalculateTransforms(Matrix transA, Matrix transB)
{
btSliderConstraint_calculateTransforms(_native, ref transA, ref transB);
btSliderConstraint_calculateTransforms(Native, ref transA, ref transB);
}
public void GetInfo1NonVirtual(ConstraintInfo1 info)
{
btSliderConstraint_getInfo1NonVirtual(_native, info._native);
btSliderConstraint_getInfo1NonVirtual(Native, info._native);
}
public void GetInfo2NonVirtual(ConstraintInfo2 info, Matrix transA, Matrix transB,
Vector3 linVelA, Vector3 linVelB, float rbAinvMass, float rbBinvMass)
{
btSliderConstraint_getInfo2NonVirtual(_native, info._native, ref transA,
btSliderConstraint_getInfo2NonVirtual(Native, info._native, ref transA,
ref transB, ref linVelA, ref linVelB, rbAinvMass, rbBinvMass);
}
public void SetFramesRef(ref Matrix frameA, ref Matrix frameB)
{
btSliderConstraint_setFrames(_native, ref frameA, ref frameB);
}
public void SetFramesRef(ref Matrix frameA, ref Matrix frameB)
{
btSliderConstraint_setFrames(Native, ref frameA, ref frameB);
}
public void SetFrames(Matrix frameA, Matrix frameB)
{
btSliderConstraint_setFrames(_native, ref frameA, ref frameB);
btSliderConstraint_setFrames(Native, ref frameA, ref frameB);
}
public void TestAngularLimits()
{
btSliderConstraint_testAngLimits(_native);
btSliderConstraint_testAngLimits(Native);
}
public void TestLinearLimits()
{
btSliderConstraint_testLinLimits(_native);
btSliderConstraint_testLinLimits(Native);
}
public Vector3 AncorInA
@ -88,7 +88,7 @@ namespace BulletSharp
get
{
Vector3 value;
btSliderConstraint_getAncorInA(_native, out value);
btSliderConstraint_getAncorInA(Native, out value);
return value;
}
}
@ -98,27 +98,21 @@ namespace BulletSharp
get
{
Vector3 value;
btSliderConstraint_getAncorInB(_native, out value);
btSliderConstraint_getAncorInB(Native, out value);
return value;
}
}
public float AngularDepth
{
get { return btSliderConstraint_getAngDepth(_native); }
}
public float AngularDepth => btSliderConstraint_getAngDepth(Native);
public float AngularPosition
{
get { return btSliderConstraint_getAngularPos(_native); }
}
public float AngularPosition => btSliderConstraint_getAngularPos(Native);
public Matrix CalculatedTransformA
{
get
{
Matrix value;
btSliderConstraint_getCalculatedTransformA(_native, out value);
btSliderConstraint_getCalculatedTransformA(Native, out value);
return value;
}
}
@ -128,58 +122,54 @@ namespace BulletSharp
get
{
Matrix value;
btSliderConstraint_getCalculatedTransformB(_native, out value);
btSliderConstraint_getCalculatedTransformB(Native, out value);
return value;
}
}
public float DampingDirAngular
{
get { return btSliderConstraint_getDampingDirAng(_native); }
set { btSliderConstraint_setDampingDirAng(_native, value); }
get => btSliderConstraint_getDampingDirAng(Native);
set => btSliderConstraint_setDampingDirAng(Native, value);
}
public float DampingDirLinear
{
get { return btSliderConstraint_getDampingDirLin(_native); }
set { btSliderConstraint_setDampingDirLin(_native, value); }
get => btSliderConstraint_getDampingDirLin(Native);
set => btSliderConstraint_setDampingDirLin(Native, value);
}
public float DampingLimAngular
{
get { return btSliderConstraint_getDampingLimAng(_native); }
set { btSliderConstraint_setDampingLimAng(_native, value); }
get => btSliderConstraint_getDampingLimAng(Native);
set => btSliderConstraint_setDampingLimAng(Native, value);
}
public float DampingLimLinear
{
get { return btSliderConstraint_getDampingLimLin(_native); }
set { btSliderConstraint_setDampingLimLin(_native, value); }
get => btSliderConstraint_getDampingLimLin(Native);
set => btSliderConstraint_setDampingLimLin(Native, value);
}
public float DampingOrthoAngular
{
get { return btSliderConstraint_getDampingOrthoAng(_native); }
set { btSliderConstraint_setDampingOrthoAng(_native, value); }
get => btSliderConstraint_getDampingOrthoAng(Native);
set => btSliderConstraint_setDampingOrthoAng(Native, value);
}
public float DampingOrthoLinear
{
get { return btSliderConstraint_getDampingOrthoLin(_native); }
set { btSliderConstraint_setDampingOrthoLin(_native, value); }
}
public SliderFlags Flags
{
get { return btSliderConstraint_getFlags(_native); }
get => btSliderConstraint_getDampingOrthoLin(Native);
set => btSliderConstraint_setDampingOrthoLin(Native, value);
}
public SliderFlags Flags => btSliderConstraint_getFlags(Native);
public Matrix FrameOffsetA
{
get
{
Matrix value;
btSliderConstraint_getFrameOffsetA(_native, out value);
btSliderConstraint_getFrameOffsetA(Native, out value);
return value;
}
}
@ -189,355 +179,173 @@ namespace BulletSharp
get
{
Matrix value;
btSliderConstraint_getFrameOffsetB(_native, out value);
btSliderConstraint_getFrameOffsetB(Native, out value);
return value;
}
}
public float LinearDepth
{
get { return btSliderConstraint_getLinDepth(_native); }
}
public float LinearDepth => btSliderConstraint_getLinDepth(Native);
public float LinearPosition
{
get { return btSliderConstraint_getLinearPos(_native); }
}
public float LinearPosition => btSliderConstraint_getLinearPos(Native);
public float LowerAngularLimit
{
get { return btSliderConstraint_getLowerAngLimit(_native); }
set { btSliderConstraint_setLowerAngLimit(_native, value); }
get => btSliderConstraint_getLowerAngLimit(Native);
set => btSliderConstraint_setLowerAngLimit(Native, value);
}
public float LowerLinearLimit
{
get { return btSliderConstraint_getLowerLinLimit(_native); }
set { btSliderConstraint_setLowerLinLimit(_native, value); }
get => btSliderConstraint_getLowerLinLimit(Native);
set => btSliderConstraint_setLowerLinLimit(Native, value);
}
public float MaxAngMotorForce
{
get { return btSliderConstraint_getMaxAngMotorForce(_native); }
set { btSliderConstraint_setMaxAngMotorForce(_native, value); }
get => btSliderConstraint_getMaxAngMotorForce(Native);
set => btSliderConstraint_setMaxAngMotorForce(Native, value);
}
public float MaxLinearMotorForce
{
get { return btSliderConstraint_getMaxLinMotorForce(_native); }
set { btSliderConstraint_setMaxLinMotorForce(_native, value); }
get => btSliderConstraint_getMaxLinMotorForce(Native);
set => btSliderConstraint_setMaxLinMotorForce(Native, value);
}
public bool PoweredAngularMotor
{
get { return btSliderConstraint_getPoweredAngMotor(_native); }
set { btSliderConstraint_setPoweredAngMotor(_native, value); }
get => btSliderConstraint_getPoweredAngMotor(Native);
set => btSliderConstraint_setPoweredAngMotor(Native, value);
}
public bool PoweredLinearMotor
{
get { return btSliderConstraint_getPoweredLinMotor(_native); }
set { btSliderConstraint_setPoweredLinMotor(_native, value); }
get => btSliderConstraint_getPoweredLinMotor(Native);
set => btSliderConstraint_setPoweredLinMotor(Native, value);
}
public float RestitutionDirAngular
{
get { return btSliderConstraint_getRestitutionDirAng(_native); }
set { btSliderConstraint_setRestitutionDirAng(_native, value); }
get => btSliderConstraint_getRestitutionDirAng(Native);
set => btSliderConstraint_setRestitutionDirAng(Native, value);
}
public float RestitutionDirLinear
{
get { return btSliderConstraint_getRestitutionDirLin(_native); }
set { btSliderConstraint_setRestitutionDirLin(_native, value); }
get => btSliderConstraint_getRestitutionDirLin(Native);
set => btSliderConstraint_setRestitutionDirLin(Native, value);
}
public float RestitutionLimAngular
{
get { return btSliderConstraint_getRestitutionLimAng(_native); }
set { btSliderConstraint_setRestitutionLimAng(_native, value); }
get => btSliderConstraint_getRestitutionLimAng(Native);
set => btSliderConstraint_setRestitutionLimAng(Native, value);
}
public float RestitutionLimLinear
{
get { return btSliderConstraint_getRestitutionLimLin(_native); }
set { btSliderConstraint_setRestitutionLimLin(_native, value); }
get => btSliderConstraint_getRestitutionLimLin(Native);
set => btSliderConstraint_setRestitutionLimLin(Native, value);
}
public float RestitutionOrthoAngular
{
get { return btSliderConstraint_getRestitutionOrthoAng(_native); }
set { btSliderConstraint_setRestitutionOrthoAng(_native, value); }
get => btSliderConstraint_getRestitutionOrthoAng(Native);
set => btSliderConstraint_setRestitutionOrthoAng(Native, value);
}
public float RestitutionOrthoLinear
{
get { return btSliderConstraint_getRestitutionOrthoLin(_native); }
set { btSliderConstraint_setRestitutionOrthoLin(_native, value); }
get => btSliderConstraint_getRestitutionOrthoLin(Native);
set => btSliderConstraint_setRestitutionOrthoLin(Native, value);
}
public float SoftnessDirAngular
{
get { return btSliderConstraint_getSoftnessDirAng(_native); }
set { btSliderConstraint_setSoftnessDirAng(_native, value); }
get => btSliderConstraint_getSoftnessDirAng(Native);
set => btSliderConstraint_setSoftnessDirAng(Native, value);
}
public float SoftnessDirLinear
{
get { return btSliderConstraint_getSoftnessDirLin(_native); }
set { btSliderConstraint_setSoftnessDirLin(_native, value); }
get => btSliderConstraint_getSoftnessDirLin(Native);
set => btSliderConstraint_setSoftnessDirLin(Native, value);
}
public float SoftnessLimAngular
{
get { return btSliderConstraint_getSoftnessLimAng(_native); }
set { btSliderConstraint_setSoftnessLimAng(_native, value); }
get => btSliderConstraint_getSoftnessLimAng(Native);
set => btSliderConstraint_setSoftnessLimAng(Native, value);
}
public float SoftnessLimLinear
{
get { return btSliderConstraint_getSoftnessLimLin(_native); }
set { btSliderConstraint_setSoftnessLimLin(_native, value); }
get => btSliderConstraint_getSoftnessLimLin(Native);
set => btSliderConstraint_setSoftnessLimLin(Native, value);
}
public float SoftnessOrthoAngular
{
get { return btSliderConstraint_getSoftnessOrthoAng(_native); }
set { btSliderConstraint_setSoftnessOrthoAng(_native, value); }
get => btSliderConstraint_getSoftnessOrthoAng(Native);
set => btSliderConstraint_setSoftnessOrthoAng(Native, value);
}
public float SoftnessOrthoLinear
{
get { return btSliderConstraint_getSoftnessOrthoLin(_native); }
set { btSliderConstraint_setSoftnessOrthoLin(_native, value); }
get => btSliderConstraint_getSoftnessOrthoLin(Native);
set => btSliderConstraint_setSoftnessOrthoLin(Native, value);
}
public bool SolveAngularLimit
{
get { return btSliderConstraint_getSolveAngLimit(_native); }
}
public bool SolveAngularLimit => btSliderConstraint_getSolveAngLimit(Native);
public bool SolveLinearLimit
{
get { return btSliderConstraint_getSolveLinLimit(_native); }
}
public bool SolveLinearLimit => btSliderConstraint_getSolveLinLimit(Native);
public float TargetAngularMotorVelocity
{
get { return btSliderConstraint_getTargetAngMotorVelocity(_native); }
set { btSliderConstraint_setTargetAngMotorVelocity(_native, value); }
get => btSliderConstraint_getTargetAngMotorVelocity(Native);
set => btSliderConstraint_setTargetAngMotorVelocity(Native, value);
}
public float TargetLinearMotorVelocity
{
get { return btSliderConstraint_getTargetLinMotorVelocity(_native); }
set { btSliderConstraint_setTargetLinMotorVelocity(_native, value); }
get => btSliderConstraint_getTargetLinMotorVelocity(Native);
set => btSliderConstraint_setTargetLinMotorVelocity(Native, value);
}
public float UpperAngularLimit
{
get { return btSliderConstraint_getUpperAngLimit(_native); }
set { btSliderConstraint_setUpperAngLimit(_native, value); }
get => btSliderConstraint_getUpperAngLimit(Native);
set => btSliderConstraint_setUpperAngLimit(Native, value);
}
public float UpperLinearLimit
{
get { return btSliderConstraint_getUpperLinLimit(_native); }
set { btSliderConstraint_setUpperLinLimit(_native, value); }
get => btSliderConstraint_getUpperLinLimit(Native);
set => btSliderConstraint_setUpperLinLimit(Native, value);
}
public bool UseFrameOffset
{
get { return btSliderConstraint_getUseFrameOffset(_native); }
set { btSliderConstraint_setUseFrameOffset(_native, value); }
get => btSliderConstraint_getUseFrameOffset(Native);
set => btSliderConstraint_setUseFrameOffset(Native, value);
}
public bool UseLinearReferenceFrameA
{
get { return btSliderConstraint_getUseLinearReferenceFrameA(_native); }
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btSliderConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Matrix frameInA, [In] ref Matrix frameInB, bool useLinearReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btSliderConstraint_new2(IntPtr rbB, [In] ref Matrix frameInB, bool useLinearReferenceFrameA);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_calculateTransforms(IntPtr obj, [In] ref Matrix transA, [In] ref Matrix transB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getAncorInA(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getAncorInB(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getAngDepth(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getAngularPos(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getCalculatedTransformA(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getCalculatedTransformB(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getDampingDirAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getDampingDirLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getDampingLimAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getDampingLimLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getDampingOrthoAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getDampingOrthoLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern SliderFlags btSliderConstraint_getFlags(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getFrameOffsetA(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getFrameOffsetB(IntPtr obj, out Matrix value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getInfo1NonVirtual(IntPtr obj, IntPtr info);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_getInfo2NonVirtual(IntPtr obj, IntPtr info, [In] ref Matrix transA, [In] ref Matrix transB, [In] ref Vector3 linVelA, [In] ref Vector3 linVelB, float rbAinvMass, float rbBinvMass);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getLinDepth(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getLinearPos(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getLowerAngLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getLowerLinLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getMaxAngMotorForce(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getMaxLinMotorForce(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btSliderConstraint_getPoweredAngMotor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btSliderConstraint_getPoweredLinMotor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getRestitutionDirAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getRestitutionDirLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getRestitutionLimAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getRestitutionLimLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getRestitutionOrthoAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getRestitutionOrthoLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getSoftnessDirAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getSoftnessDirLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getSoftnessLimAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getSoftnessLimLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getSoftnessOrthoAng(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getSoftnessOrthoLin(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btSliderConstraint_getSolveAngLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btSliderConstraint_getSolveLinLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getTargetAngMotorVelocity(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getTargetLinMotorVelocity(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getUpperAngLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btSliderConstraint_getUpperLinLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btSliderConstraint_getUseFrameOffset(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btSliderConstraint_getUseLinearReferenceFrameA(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setDampingDirAng(IntPtr obj, float dampingDirAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setDampingDirLin(IntPtr obj, float dampingDirLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setDampingLimAng(IntPtr obj, float dampingLimAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setDampingLimLin(IntPtr obj, float dampingLimLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setDampingOrthoAng(IntPtr obj, float dampingOrthoAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setDampingOrthoLin(IntPtr obj, float dampingOrthoLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setFrames(IntPtr obj, [In] ref Matrix frameA, [In] ref Matrix frameB);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setLowerAngLimit(IntPtr obj, float lowerLimit);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setLowerLinLimit(IntPtr obj, float lowerLimit);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setMaxAngMotorForce(IntPtr obj, float maxAngMotorForce);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setMaxLinMotorForce(IntPtr obj, float maxLinMotorForce);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setPoweredAngMotor(IntPtr obj, bool onOff);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setPoweredLinMotor(IntPtr obj, bool onOff);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setRestitutionDirAng(IntPtr obj, float restitutionDirAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setRestitutionDirLin(IntPtr obj, float restitutionDirLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setRestitutionLimAng(IntPtr obj, float restitutionLimAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setRestitutionLimLin(IntPtr obj, float restitutionLimLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setRestitutionOrthoAng(IntPtr obj, float restitutionOrthoAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setRestitutionOrthoLin(IntPtr obj, float restitutionOrthoLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setSoftnessDirAng(IntPtr obj, float softnessDirAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setSoftnessDirLin(IntPtr obj, float softnessDirLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setSoftnessLimAng(IntPtr obj, float softnessLimAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setSoftnessLimLin(IntPtr obj, float softnessLimLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setSoftnessOrthoAng(IntPtr obj, float softnessOrthoAng);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setSoftnessOrthoLin(IntPtr obj, float softnessOrthoLin);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setTargetAngMotorVelocity(IntPtr obj, float targetAngMotorVelocity);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setTargetLinMotorVelocity(IntPtr obj, float targetLinMotorVelocity);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setUpperAngLimit(IntPtr obj, float upperLimit);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setUpperLinLimit(IntPtr obj, float upperLimit);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_setUseFrameOffset(IntPtr obj, bool frameOffsetOnOff);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_testAngLimits(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btSliderConstraint_testLinLimits(IntPtr obj);
public bool UseLinearReferenceFrameA => btSliderConstraint_getUseLinearReferenceFrameA(Native);
}
[StructLayout(LayoutKind.Sequential)]
internal struct SliderConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public TransformFloatData RigidBodyAFrame;
public TransformFloatData RigidBodyBFrame;
public float LinearUpperLimit;
public float LinearLowerLimit;
public float AngularUpperLimit;
public float AngularLowerLimit;
public int UseLinearReferenceFrameA;
public int UseOffsetForConstraintFrame;
[StructLayout(LayoutKind.Sequential)]
internal struct SliderConstraintFloatData
{
public TypedConstraintFloatData TypedConstraintData;
public TransformFloatData RigidBodyAFrame;
public TransformFloatData RigidBodyBFrame;
public float LinearUpperLimit;
public float LinearLowerLimit;
public float AngularUpperLimit;
public float AngularLowerLimit;
public int UseLinearReferenceFrameA;
public int UseOffsetForConstraintFrame;
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(SliderConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(SliderConstraintFloatData), fieldName).ToInt32(); }
}
}

Просмотреть файл

@ -1,11 +1,11 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
public enum ConstraintParam
public enum ConstraintParam
{
Erp = 1,
StopErp,
@ -15,26 +15,26 @@ namespace BulletSharp
public enum TypedConstraintType
{
Point2Point = 3,
Hinge,
ConeTwist,
D6,
Slider,
Contact,
D6Spring,
Gear,
Fixed,
D6Spring2,
Max
Point2Point = 3,
Hinge,
ConeTwist,
D6,
Slider,
Contact,
D6Spring,
Gear,
Fixed,
D6Spring2,
Max
}
public class JointFeedback : IDisposable
{
internal IntPtr _native;
internal IntPtr Native;
public JointFeedback()
{
_native = btJointFeedback_new();
Native = btJointFeedback_new();
}
public Vector3 AppliedForceBodyA
@ -42,10 +42,10 @@ namespace BulletSharp
get
{
Vector3 value;
btJointFeedback_getAppliedForceBodyA(_native, out value);
btJointFeedback_getAppliedForceBodyA(Native, out value);
return value;
}
set { btJointFeedback_setAppliedForceBodyA(_native, ref value); }
set => btJointFeedback_setAppliedForceBodyA(Native, ref value);
}
public Vector3 AppliedForceBodyB
@ -53,10 +53,10 @@ namespace BulletSharp
get
{
Vector3 value;
btJointFeedback_getAppliedForceBodyB(_native, out value);
btJointFeedback_getAppliedForceBodyB(Native, out value);
return value;
}
set { btJointFeedback_setAppliedForceBodyB(_native, ref value); }
set => btJointFeedback_setAppliedForceBodyB(Native, ref value);
}
public Vector3 AppliedTorqueBodyA
@ -64,10 +64,10 @@ namespace BulletSharp
get
{
Vector3 value;
btJointFeedback_getAppliedTorqueBodyA(_native, out value);
btJointFeedback_getAppliedTorqueBodyA(Native, out value);
return value;
}
set { btJointFeedback_setAppliedTorqueBodyA(_native, ref value); }
set => btJointFeedback_setAppliedTorqueBodyA(Native, ref value);
}
public Vector3 AppliedTorqueBodyB
@ -75,10 +75,10 @@ namespace BulletSharp
get
{
Vector3 value;
btJointFeedback_getAppliedTorqueBodyB(_native, out value);
btJointFeedback_getAppliedTorqueBodyB(Native, out value);
return value;
}
set { btJointFeedback_setAppliedTorqueBodyB(_native, ref value); }
set => btJointFeedback_setAppliedTorqueBodyB(Native, ref value);
}
public void Dispose()
@ -89,10 +89,10 @@ namespace BulletSharp
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
if (Native != IntPtr.Zero)
{
btJointFeedback_delete(_native);
_native = IntPtr.Zero;
btJointFeedback_delete(Native);
Native = IntPtr.Zero;
}
}
@ -100,27 +100,6 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btJointFeedback_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_getAppliedForceBodyA(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_getAppliedForceBodyB(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_getAppliedTorqueBodyA(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_getAppliedTorqueBodyB(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_setAppliedForceBodyA(IntPtr obj, [In] ref Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_setAppliedForceBodyB(IntPtr obj, [In] ref Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_setAppliedTorqueBodyA(IntPtr obj, [In] ref Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_setAppliedTorqueBodyB(IntPtr obj, [In] ref Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btJointFeedback_delete(IntPtr obj);
}
public abstract class TypedConstraint : IDisposable
@ -136,14 +115,14 @@ namespace BulletSharp
public int Nub
{
get { return btTypedConstraint_btConstraintInfo1_getNub(_native); }
set { btTypedConstraint_btConstraintInfo1_setNub(_native, value); }
get => btTypedConstraint_btConstraintInfo1_getNub(_native);
set => btTypedConstraint_btConstraintInfo1_setNub(_native, value);
}
public int NumConstraintRows
{
get { return btTypedConstraint_btConstraintInfo1_getNumConstraintRows(_native); }
set { btTypedConstraint_btConstraintInfo1_setNumConstraintRows(_native, value); }
get => btTypedConstraint_btConstraintInfo1_getNumConstraintRows(_native);
set => btTypedConstraint_btConstraintInfo1_setNumConstraintRows(_native, value);
}
public void Dispose()
@ -165,19 +144,6 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo1_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_btConstraintInfo1_getNub(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_btConstraintInfo1_getNumConstraintRows(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo1_setNub(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo1_setNumConstraintRows(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo1_delete(IntPtr obj);
}
public class ConstraintInfo2 : IDisposable
@ -188,7 +154,7 @@ namespace BulletSharp
{
_native = btTypedConstraint_btConstraintInfo2_new();
}
/*
/*
public float Cfm
{
get { return btTypedConstraint_btConstraintInfo2_getCfm(_native); }
@ -200,31 +166,31 @@ namespace BulletSharp
get { return btTypedConstraint_btConstraintInfo2_getConstraintError(_native); }
set { btTypedConstraint_btConstraintInfo2_setConstraintError(_native, value._native); }
}
*/
*/
public float Damping
{
get { return btTypedConstraint_btConstraintInfo2_getDamping(_native); }
set { btTypedConstraint_btConstraintInfo2_setDamping(_native, value); }
get => btTypedConstraint_btConstraintInfo2_getDamping(_native);
set => btTypedConstraint_btConstraintInfo2_setDamping(_native, value);
}
public float Erp
{
get { return btTypedConstraint_btConstraintInfo2_getErp(_native); }
set { btTypedConstraint_btConstraintInfo2_setErp(_native, value); }
get => btTypedConstraint_btConstraintInfo2_getErp(_native);
set => btTypedConstraint_btConstraintInfo2_setErp(_native, value);
}
/*
/*
public int Findex
{
get { return btTypedConstraint_btConstraintInfo2_getFindex(_native); }
set { btTypedConstraint_btConstraintInfo2_setFindex(_native, value._native); }
}
*/
*/
public float Fps
{
get { return btTypedConstraint_btConstraintInfo2_getFps(_native); }
set { btTypedConstraint_btConstraintInfo2_setFps(_native, value); }
get => btTypedConstraint_btConstraintInfo2_getFps(_native);
set => btTypedConstraint_btConstraintInfo2_setFps(_native, value);
}
/*
/*
public float J1angularAxis
{
get { return btTypedConstraint_btConstraintInfo2_getJ1angularAxis(_native); }
@ -254,25 +220,25 @@ namespace BulletSharp
get { return btTypedConstraint_btConstraintInfo2_getLowerLimit(_native); }
set { btTypedConstraint_btConstraintInfo2_setLowerLimit(_native, value._native); }
}
*/
*/
public int NumIterations
{
get { return btTypedConstraint_btConstraintInfo2_getNumIterations(_native); }
set { btTypedConstraint_btConstraintInfo2_setNumIterations(_native, value); }
get => btTypedConstraint_btConstraintInfo2_getNumIterations(_native);
set => btTypedConstraint_btConstraintInfo2_setNumIterations(_native, value);
}
public int Rowskip
{
get { return btTypedConstraint_btConstraintInfo2_getRowskip(_native); }
set { btTypedConstraint_btConstraintInfo2_setRowskip(_native, value); }
get => btTypedConstraint_btConstraintInfo2_getRowskip(_native);
set => btTypedConstraint_btConstraintInfo2_setRowskip(_native, value);
}
/*
/*
public float UpperLimit
{
get { return btTypedConstraint_btConstraintInfo2_getUpperLimit(_native); }
set { btTypedConstraint_btConstraintInfo2_setUpperLimit(_native, value._native); }
}
*/
*/
public void Dispose()
{
Dispose(true);
@ -292,155 +258,94 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getCfm(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getConstraintError(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_btConstraintInfo2_getDamping(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_btConstraintInfo2_getErp(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getFindex(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_btConstraintInfo2_getFps(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getJ1angularAxis(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getJ1linearAxis(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getJ2angularAxis(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getJ2linearAxis(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getLowerLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_btConstraintInfo2_getNumIterations(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_btConstraintInfo2_getRowskip(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_btConstraintInfo2_getUpperLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setCfm(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setConstraintError(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setDamping(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setErp(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setFindex(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setFps(IntPtr obj, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setJ1angularAxis(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setJ1linearAxis(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setJ2angularAxis(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setJ2linearAxis(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setLowerLimit(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setNumIterations(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setRowskip(IntPtr obj, int value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_setUpperLimit(IntPtr obj, IntPtr value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_btConstraintInfo2_delete(IntPtr obj);
}
internal IntPtr _native;
internal IntPtr Native;
private JointFeedback _jointFeedback;
protected RigidBody _rigidBodyA;
protected RigidBody _rigidBodyB;
static RigidBody _fixedBody;
private static RigidBody _fixedBody;
internal TypedConstraint(IntPtr native)
{
_native = native;
Native = native;
}
public void BuildJacobian()
{
btTypedConstraint_buildJacobian(_native);
btTypedConstraint_buildJacobian(Native);
}
public int CalculateSerializeBufferSize()
{
return btTypedConstraint_calculateSerializeBufferSize(_native);
return btTypedConstraint_calculateSerializeBufferSize(Native);
}
public void EnableFeedback(bool needsFeedback)
{
btTypedConstraint_enableFeedback(_native, needsFeedback);
btTypedConstraint_enableFeedback(Native, needsFeedback);
}
public static RigidBody GetFixedBody()
{
if (_fixedBody == null)
{
using (var cinfo = new RigidBodyConstructionInfo(0, null, null))
{
_fixedBody = new RigidBody(cinfo);
_fixedBody.SetMassProps(0, Vector3.Zero);
}
}
return _fixedBody;
}
public static RigidBody GetFixedBody()
{
if (_fixedBody == null)
{
using (var cinfo = new RigidBodyConstructionInfo(0, null, null))
{
_fixedBody = new RigidBody(cinfo);
_fixedBody.SetMassProps(0, Vector3.Zero);
}
}
return _fixedBody;
}
public void GetInfo1(ConstraintInfo1 info)
{
btTypedConstraint_getInfo1(_native, info._native);
btTypedConstraint_getInfo1(Native, info._native);
}
public void GetInfo2(ConstraintInfo2 info)
{
btTypedConstraint_getInfo2(_native, info._native);
btTypedConstraint_getInfo2(Native, info._native);
}
public float GetParam(ConstraintParam num)
public float GetParam(ConstraintParam num)
{
return btTypedConstraint_getParam(_native, num);
return btTypedConstraint_getParam(Native, num);
}
public float GetParam(ConstraintParam num, int axis)
public float GetParam(ConstraintParam num, int axis)
{
return btTypedConstraint_getParam2(_native, num, axis);
return btTypedConstraint_getParam2(Native, num, axis);
}
public float InternalGetAppliedImpulse()
{
return btTypedConstraint_internalGetAppliedImpulse(_native);
return btTypedConstraint_internalGetAppliedImpulse(Native);
}
public void InternalSetAppliedImpulse(float appliedImpulse)
{
btTypedConstraint_internalSetAppliedImpulse(_native, appliedImpulse);
btTypedConstraint_internalSetAppliedImpulse(Native, appliedImpulse);
}
public string Serialize(IntPtr dataBuffer, Serializer serializer)
{
return Marshal.PtrToStringAnsi(btTypedConstraint_serialize(_native, dataBuffer, serializer._native));
return Marshal.PtrToStringAnsi(btTypedConstraint_serialize(Native, dataBuffer, serializer._native));
}
public void SetParam(ConstraintParam num, float value)
public void SetParam(ConstraintParam num, float value)
{
btTypedConstraint_setParam(_native, num, value);
btTypedConstraint_setParam(Native, num, value);
}
public void SetParam(ConstraintParam num, float value, int axis)
public void SetParam(ConstraintParam num, float value, int axis)
{
btTypedConstraint_setParam2(_native, num, value, axis);
btTypedConstraint_setParam2(Native, num, value, axis);
}
/*
/*
public void SetupSolverConstraint(btAlignedObjectArray<btSolverConstraint> ca,
int solverBodyA, int solverBodyB, float timeStep)
{
@ -454,267 +359,140 @@ namespace BulletSharp
btTypedConstraint_solveConstraintObsolete(_native, __unnamed0._native,
__unnamed1._native, __unnamed2);
}
*/
public float AppliedImpulse
{
get { return btTypedConstraint_getAppliedImpulse(_native); }
}
*/
public float AppliedImpulse => btTypedConstraint_getAppliedImpulse(Native);
public float BreakingImpulseThreshold
{
get { return btTypedConstraint_getBreakingImpulseThreshold(_native); }
set { btTypedConstraint_setBreakingImpulseThreshold(_native, value); }
get => btTypedConstraint_getBreakingImpulseThreshold(Native);
set => btTypedConstraint_setBreakingImpulseThreshold(Native, value);
}
public TypedConstraintType ConstraintType
{
get { return btTypedConstraint_getConstraintType(_native); }
}
public TypedConstraintType ConstraintType => btTypedConstraint_getConstraintType(Native);
public float DebugDrawSize
{
get { return btTypedConstraint_getDbgDrawSize(_native); }
set { btTypedConstraint_setDbgDrawSize(_native, value); }
get => btTypedConstraint_getDbgDrawSize(Native);
set => btTypedConstraint_setDbgDrawSize(Native, value);
}
public bool IsEnabled
{
get { return btTypedConstraint_isEnabled(_native); }
set { btTypedConstraint_setEnabled(_native, value); }
get => btTypedConstraint_isEnabled(Native);
set => btTypedConstraint_setEnabled(Native, value);
}
public JointFeedback JointFeedback
{
get { return _jointFeedback; }
get => _jointFeedback;
set
{
btTypedConstraint_setJointFeedback(_native, (value == null) ? value._native : IntPtr.Zero);
btTypedConstraint_setJointFeedback(Native, (value == null) ? value.Native : IntPtr.Zero);
_jointFeedback = value;
}
}
public bool NeedsFeedback
{
get { return btTypedConstraint_needsFeedback(_native); }
}
public bool NeedsFeedback => btTypedConstraint_needsFeedback(Native);
public int OverrideNumSolverIterations
{
get { return btTypedConstraint_getOverrideNumSolverIterations(_native); }
set { btTypedConstraint_setOverrideNumSolverIterations(_native, value); }
get => btTypedConstraint_getOverrideNumSolverIterations(Native);
set => btTypedConstraint_setOverrideNumSolverIterations(Native, value);
}
public RigidBody RigidBodyA
{
get { return _rigidBodyA; }
}
public RigidBody RigidBodyA => _rigidBodyA;
public RigidBody RigidBodyB
{
get { return _rigidBodyB; }
}
public RigidBody RigidBodyB => _rigidBodyB;
public int Uid
{
get { return btTypedConstraint_getUid(_native); }
}
public int Uid => btTypedConstraint_getUid(Native);
public int UserConstraintId
{
get { return btTypedConstraint_getUserConstraintId(_native); }
set { btTypedConstraint_setUserConstraintId(_native, value); }
get => btTypedConstraint_getUserConstraintId(Native);
set => btTypedConstraint_setUserConstraintId(Native, value);
}
public Object Userobject { get; set; }
public Object Userobject { get; set; }
public int UserConstraintType
{
get { return btTypedConstraint_getUserConstraintType(_native); }
set { btTypedConstraint_setUserConstraintType(_native, value); }
get => btTypedConstraint_getUserConstraintType(Native);
set => btTypedConstraint_setUserConstraintType(Native, value);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
{
btTypedConstraint_delete(_native);
_native = IntPtr.Zero;
}
}
protected virtual void Dispose(bool disposing)
{
if (Native != IntPtr.Zero)
{
btTypedConstraint_delete(Native);
Native = IntPtr.Zero;
}
}
~TypedConstraint()
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_buildJacobian(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_calculateSerializeBufferSize(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_enableFeedback(IntPtr obj, bool needsFeedback);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_getAppliedImpulse(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_getBreakingImpulseThreshold(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern TypedConstraintType btTypedConstraint_getConstraintType(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_getDbgDrawSize(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btTypedConstraint_getFixedBody();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_getInfo1(IntPtr obj, IntPtr info);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_getInfo2(IntPtr obj, IntPtr info);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_getJointFeedback(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_getOverrideNumSolverIterations(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_getParam(IntPtr obj, ConstraintParam num);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_getParam2(IntPtr obj, ConstraintParam num, int axis);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btTypedConstraint_getRigidBodyA(IntPtr obj);
//[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
//static extern IntPtr btTypedConstraint_getRigidBodyB(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_getUid(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_getUserConstraintId(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_getUserConstraintPtr(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern int btTypedConstraint_getUserConstraintType(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btTypedConstraint_internalGetAppliedImpulse(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_internalSetAppliedImpulse(IntPtr obj, float appliedImpulse);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btTypedConstraint_isEnabled(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btTypedConstraint_needsFeedback(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btTypedConstraint_serialize(IntPtr obj, IntPtr dataBuffer, IntPtr serializer);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setBreakingImpulseThreshold(IntPtr obj, float threshold);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setDbgDrawSize(IntPtr obj, float dbgDrawSize);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setEnabled(IntPtr obj, bool enabled);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setJointFeedback(IntPtr obj, IntPtr jointFeedback);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setOverrideNumSolverIterations(IntPtr obj, int overideNumIterations);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setParam(IntPtr obj, ConstraintParam num, float value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setParam2(IntPtr obj, ConstraintParam num, float value, int axis);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setupSolverConstraint(IntPtr obj, IntPtr ca, int solverBodyA, int solverBodyB, float timeStep);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setUserConstraintId(IntPtr obj, int uid);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setUserConstraintPtr(IntPtr obj, IntPtr ptr);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_setUserConstraintType(IntPtr obj, int userConstraintType);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_solveConstraintObsolete(IntPtr obj, IntPtr __unnamed0, IntPtr __unnamed1, float __unnamed2);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btTypedConstraint_delete(IntPtr obj);
~TypedConstraint()
{
Dispose(false);
}
}
public class AngularLimit : IDisposable
{
internal IntPtr _native;
bool _preventDelete;
internal IntPtr Native;
private bool _preventDelete;
internal AngularLimit(IntPtr native, bool preventDelete)
{
_native = native;
Native = native;
_preventDelete = preventDelete;
}
public AngularLimit()
{
_native = btAngularLimit_new();
Native = btAngularLimit_new();
}
public void Fit(ref float angle)
{
btAngularLimit_fit(_native, ref angle);
btAngularLimit_fit(Native, ref angle);
}
public void Set(float low, float high, float softness = 0.9f, float biasFactor = 0.3f,
float relaxationFactor = 1.0f)
{
btAngularLimit_set(_native, low, high, softness, biasFactor, relaxationFactor);
btAngularLimit_set(Native, low, high, softness, biasFactor, relaxationFactor);
}
public void Test(float angle)
{
btAngularLimit_test(_native, angle);
btAngularLimit_test(Native, angle);
}
public float BiasFactor
{
get { return btAngularLimit_getBiasFactor(_native); }
}
public float BiasFactor => btAngularLimit_getBiasFactor(Native);
public float Correction
{
get { return btAngularLimit_getCorrection(_native); }
}
public float Correction => btAngularLimit_getCorrection(Native);
public float Error
{
get { return btAngularLimit_getError(_native); }
}
public float Error => btAngularLimit_getError(Native);
public float HalfRange
{
get { return btAngularLimit_getHalfRange(_native); }
}
public float HalfRange => btAngularLimit_getHalfRange(Native);
public float High
{
get { return btAngularLimit_getHigh(_native); }
}
public float High => btAngularLimit_getHigh(Native);
public bool IsLimit
{
get { return btAngularLimit_isLimit(_native); }
}
public bool IsLimit => btAngularLimit_isLimit(Native);
public float Low
{
get { return btAngularLimit_getLow(_native); }
}
public float Low => btAngularLimit_getLow(Native);
public float RelaxationFactor
{
get { return btAngularLimit_getRelaxationFactor(_native); }
}
public float RelaxationFactor => btAngularLimit_getRelaxationFactor(Native);
public float Sign
{
get { return btAngularLimit_getSign(_native); }
}
public float Sign => btAngularLimit_getSign(Native);
public float Softness
{
get { return btAngularLimit_getSoftness(_native); }
}
public float Softness => btAngularLimit_getSoftness(Native);
public void Dispose()
{
@ -724,13 +502,13 @@ namespace BulletSharp
protected virtual void Dispose(bool disposing)
{
if (_native != IntPtr.Zero)
if (Native != IntPtr.Zero)
{
if (!_preventDelete)
{
btAngularLimit_delete(_native);
btAngularLimit_delete(Native);
}
_native = IntPtr.Zero;
Native = IntPtr.Zero;
}
}
@ -738,57 +516,25 @@ namespace BulletSharp
{
Dispose(false);
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btAngularLimit_new();
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btAngularLimit_fit(IntPtr obj, ref float angle);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getBiasFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getCorrection(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getError(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getHalfRange(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getHigh(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getLow(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getRelaxationFactor(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getSign(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btAngularLimit_getSoftness(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I1)]
static extern bool btAngularLimit_isLimit(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btAngularLimit_set(IntPtr obj, float low, float high, float _softness, float _biasFactor, float _relaxationFactor);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btAngularLimit_test(IntPtr obj, float angle);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btAngularLimit_delete(IntPtr obj);
}
[StructLayout(LayoutKind.Sequential)]
internal struct TypedConstraintFloatData
{
public IntPtr RigidBodyA;
public IntPtr RigidBodyB;
public IntPtr Name;
public int ObjectType;
public int UserConstraintType;
public int UserConstraintId;
public int NeedsFeedback;
public float AppliedImpulse;
public float DebugDrawSize;
public int DisableCollisionsBetweenLinkedBodies;
public int OverrideNumSolverIterations;
public float BreakingImpulseThreshold;
public int IsEnabled;
[StructLayout(LayoutKind.Sequential)]
internal struct TypedConstraintFloatData
{
public IntPtr RigidBodyA;
public IntPtr RigidBodyB;
public IntPtr Name;
public int ObjectType;
public int UserConstraintType;
public int UserConstraintId;
public int NeedsFeedback;
public float AppliedImpulse;
public float DebugDrawSize;
public int DisableCollisionsBetweenLinkedBodies;
public int OverrideNumSolverIterations;
public float BreakingImpulseThreshold;
public int IsEnabled;
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(TypedConstraintFloatData), fieldName).ToInt32(); }
}
public static int Offset(string fieldName) { return Marshal.OffsetOf(typeof(TypedConstraintFloatData), fieldName).ToInt32(); }
}
}

Просмотреть файл

@ -1,7 +1,5 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using BulletSharp.Math;
using static BulletSharp.UnsafeNativeMethods;
namespace BulletSharp
{
@ -18,12 +16,12 @@ namespace BulletSharp
public void SetLowerLimit(float ang1min, float ang2min)
{
btUniversalConstraint_setLowerLimit(_native, ang1min, ang2min);
btUniversalConstraint_setLowerLimit(Native, ang1min, ang2min);
}
public void SetUpperLimit(float ang1max, float ang2max)
{
btUniversalConstraint_setUpperLimit(_native, ang1max, ang2max);
btUniversalConstraint_setUpperLimit(Native, ang1max, ang2max);
}
public Vector3 Anchor
@ -31,7 +29,7 @@ namespace BulletSharp
get
{
Vector3 value;
btUniversalConstraint_getAnchor(_native, out value);
btUniversalConstraint_getAnchor(Native, out value);
return value;
}
}
@ -41,27 +39,21 @@ namespace BulletSharp
get
{
Vector3 value;
btUniversalConstraint_getAnchor2(_native, out value);
btUniversalConstraint_getAnchor2(Native, out value);
return value;
}
}
public float Angle1
{
get { return btUniversalConstraint_getAngle1(_native); }
}
public float Angle1 => btUniversalConstraint_getAngle1(Native);
public float Angle2
{
get { return btUniversalConstraint_getAngle2(_native); }
}
public float Angle2 => btUniversalConstraint_getAngle2(Native);
public Vector3 Axis1
{
get
{
Vector3 value;
btUniversalConstraint_getAxis1(_native, out value);
btUniversalConstraint_getAxis1(Native, out value);
return value;
}
}
@ -71,28 +63,9 @@ namespace BulletSharp
get
{
Vector3 value;
btUniversalConstraint_getAxis2(_native, out value);
btUniversalConstraint_getAxis2(Native, out value);
return value;
}
}
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern IntPtr btUniversalConstraint_new(IntPtr rbA, IntPtr rbB, [In] ref Vector3 anchor, [In] ref Vector3 axis1, [In] ref Vector3 axis2);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btUniversalConstraint_getAnchor(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btUniversalConstraint_getAnchor2(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btUniversalConstraint_getAngle1(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern float btUniversalConstraint_getAngle2(IntPtr obj);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btUniversalConstraint_getAxis1(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btUniversalConstraint_getAxis2(IntPtr obj, out Vector3 value);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btUniversalConstraint_setLowerLimit(IntPtr obj, float ang1min, float ang2min);
[DllImport(Native.Dll, CallingConvention = Native.Conv), SuppressUnmanagedCodeSecurity]
static extern void btUniversalConstraint_setUpperLimit(IntPtr obj, float ang1max, float ang2max);
}
}

Просмотреть файл

@ -1,4 +1,3 @@
using System;
using BulletSharp.Math;
namespace BulletSharp

Просмотреть файл

@ -526,7 +526,7 @@ namespace BulletSharp
}
else if (obj is TypedConstraint)
{
ptr = (obj as TypedConstraint)._native;
ptr = (obj as TypedConstraint).Native;
}
else
{

Просмотреть файл

@ -23,7 +23,7 @@ namespace BulletSharp.SoftBody
}
Native = btSoftRigidDynamicsWorld_new(dispatcher.Native, pairCache.Native,
(constraintSolver != null) ? constraintSolver._native : IntPtr.Zero,
(constraintSolver != null) ? constraintSolver.Native : IntPtr.Zero,
collisionConfiguration.Native, _softBodySolver._native);
CollisionObjectArray = new AlignedCollisionObjectArray(btCollisionWorld_getCollisionObjectArray(Native), this);

Разница между файлами не показана из-за своего большого размера Загрузить разницу