📄 oxnewtoncustomjoints.pas
字号:
unit oxNewtonCustomJoints;
{******************************************************************************}
// [15-9-2007]: oxNewtonCustomJoints last change by Dave Gravel. //
{******************************************************************************}
{===============================================================================
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is "oxNewton opengl-Dynamics-delphi-component".
The Initial Developer of the Original Code is
Dave Gravel, OrionX3D Opengl & Delphi Programming, dave.gravel@cgocable.ca.
http://www.Dave.ServeUsers.com
http://www.k00m.sexidude.com
Portions created by Dave Gravel are Copyright (C) 2004 - 2006.
Dave Gravel. All Rights Reserved.
Contributor(s): GLScene (http://www.glscene.org) -
Julio Jerez and Alain Suero (http://www.newtondynamics.com) -
Sascha Willems (www.delphigl.de)
================================================================================
oxNewton v1.55 by Dave Gravel.
PS: I request only one thing from the users of my oxNewton Component,
it is to put on your about or your help a comment saying you using the
oxNewton Component with my name Dave Gravel and my
e-mail: dave.gravel@cgocable.ca
Don't modify or remove any comment or information on my file
if you do some modification on my code please contact me.
Read the Newton license too, it is realy important.
================================================================================}
// All of this custom joint is write by Julio but some part can have change from
// me or others.
// I have integred it to my system.
//********************************************************************
// Newton Game dynamics
// copyright 2000-2004
// By Julio Jerez
// VC: 6.0
// simple demo list vector class with iterators
//********************************************************************
interface
uses
// Windows
Forms, Windows, Classes, Messages, SysUtils, Graphics, Controls, ExtCtrls,
Dialogs, StdCtrls,
// GLScene
GLScene, GLMisc, GLObjects, VectorGeometry, GLVectorFileObjects, VectorLists,
GLTexture, VectorTypes,
// Newton
oxNewtonManager, oxNewtonJoint, oxNewtonImport, oxNewtonUtils;
//const
// MIN_JOINT_PIN_LENGTH = 50.0;
{******************************************************************************}
// [15-9-2007]: TOXCBallAndSocketJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCBallAndSocketJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
end;
{******************************************************************************}
// [15-9-2007]: TOXCConeLimitedBallAndSocketJoint last change by Dave Gravel.//
{******************************************************************************}
type
TOXCConeLimitedBallAndSocketJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FConeMaxAngle, FConeTwistAngle, FCosConeAngle: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointConeMaxAngle: Float read FConeMaxAngle write FConeMaxAngle;
property JointConeTwistAngle: Float read FConeTwistAngle write FConeTwistAngle;
end;
{******************************************************************************}
// [15-9-2007]: TOXCCorkScrewJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCCorkScrewJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FJointLimitsOn: boolean;
FJointMinDist: Float;
FJointMaxDist: Float;
FJointAngularMotorOn: boolean;
FJointAngularDamp: Float;
FJointAngularAccel: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointLimitsOn: boolean read FJointLimitsOn write FJointLimitsOn;
property JointMinDist: Float read FJointMinDist write FJointMinDist;
property JointMaxDist: Float read FJointMaxDist write FJointMaxDist;
property JointAngularMotorOn: boolean read FJointAngularMotorOn write FJointAngularMotorOn;
property JointAngularDamp: Float read FJointAngularDamp write FJointAngularDamp;
property JointAngularAccel: Float read FJointAngularAccel write FJointAngularAccel;
end;
{******************************************************************************}
// [15-9-2007]: TOXCHingeJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCHingeJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FJointLimitsOn: boolean;
FJointMinAngle: Float;
FJointMaxAngle: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointLimitsOn: boolean read FJointLimitsOn write FJointLimitsOn;
property JointMinAngle: Float read FJointMinAngle write FJointMinAngle;
property JointMaxAngle: Float read FJointMaxAngle write FJointMaxAngle;
end;
{******************************************************************************}
// [15-9-2007]: TOXCUniversalJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCUniversalJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FJointLimitOn0: boolean;
FJointLimitOn1: boolean;
FJointAngularmotorOn0: boolean;
FJointAngularmotorOn1: boolean;
FJointMinAngle0: Float;
FJointMaxAngle0: Float;
FJointMinAngle1: Float;
FJointMaxAngle1: Float;
FJointAngularDamp0: Float;
FJointAngularAccel0: Float;
FJointAngularDamp1: Float;
FJointAngularAccel1: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomBothCreate( cBody, pBody: PNewtonBody; cPivot, cPin, pPivot, pPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointLimitOn0: boolean read FJointLimitOn0 write FJointLimitOn0;
property JointLimitOn1: boolean read FJointLimitOn1 write FJointLimitOn1;
property JointAngularmotorOn0: boolean read FJointAngularmotorOn0 write FJointAngularmotorOn0;
property JointAngularmotorOn1: boolean read FJointAngularmotorOn1 write FJointAngularmotorOn1;
property JointMinAngle0: Float read FJointMinAngle0 write FJointMinAngle0;
property JointMaxAngle0: Float read FJointMaxAngle0 write FJointMaxAngle0;
property JointMinAngle1: Float read FJointMinAngle1 write FJointMinAngle1;
property JointMaxAngle1: Float read FJointMaxAngle1 write FJointMaxAngle1;
property JointAngularDamp0: Float read FJointAngularDamp0 write FJointAngularDamp0;
property JointAngularAccel0: Float read FJointAngularAccel0 write FJointAngularAccel0;
property JointAngularDamp1: Float read FJointAngularDamp1 write FJointAngularDamp1;
property JointAngularAccel1: Float read FJointAngularAccel1 write FJointAngularAccel1;
end;
{******************************************************************************}
// [15-9-2007]: TOXCPulleyJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCPulleyJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FJointGearRatio: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomBothCreate( cBody, pBody: PNewtonBody; cPivot, cPin, pPivot, pPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointGearRatio: Float read FJointGearRatio write FJointGearRatio;
end;
{******************************************************************************}
// [15-9-2007]: TOXCDryRollingFrictionJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCDryRollingFrictionJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FFrictionCoef: Float;
FFrictionTorque: Float;
FJointRadius: Float;
FPin: TOXVector3;
FJointCoeficient: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
destructor Destroy; override;
published
property JointRadius: Float read FJointRadius write FJointRadius;
property JointCoeficient: Float read FJointCoeficient write FJointCoeficient;
end;
{******************************************************************************}
// [15-9-2007]: TOXCUpVectorJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCUpVectorJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
procedure UpdatePinDir;
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
end;
{******************************************************************************}
// [15-9-2007]: TOXCSliderJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCSliderJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FJointLimitsOn: boolean;
FJointMinDist: Float;
FJointMaxDist: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomCreate( cBody, pBody: PNewtonBody; cPivot, cPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointLimitsOn: boolean read FJointLimitsOn write FJointLimitsOn;
property JointMinDist: Float read FJointMinDist write FJointMinDist;
property JointMaxDist: Float read FJointMaxDist write FJointMaxDist;
end;
{******************************************************************************}
// [15-9-2007]: TOXCGearJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCGearJoint = class( TOXUserBilateralJoint )
private
FOrionX3D: byte;
FcLocalMatrix0: TOXMatrix;
FcLocalMatrix1: TOXMatrix;
FJointGearRatio: Float;
FBody0, FBody1: PNewtonBody;
procedure CustomBothCreate( cBody, pBody: PNewtonBody; cPivot, cPin, pPivot, pPin: TOXVector4 );
public
function SubmitConstrainst( userJoint: PNewtonJoint ): cardinal;
constructor Create( aOwner: TComponent ); override;
published
property JointGearRatio: Float read FJointGearRatio write FJointGearRatio;
end;
{******************************************************************************}
// [15-9-2007]: TOXCWormGearJoint last change by Dave Gravel. //
{******************************************************************************}
type
TOXCWormGearJoint = class( TOXUserBilateralJoint )
private
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -