OROCHI
 
Loading...
Searching...
No Matches
GxDynamics Class Reference

物理演算クラス More...

#include <GxDynamics.h>

Inheritance diagram for GxDynamics:
Collaboration diagram for GxDynamics:

Classes

class  GxConditionInformation
 
class  GxConstraint
 GxDynamics 拘束クラス More...
 
class  GxObject
 GxDynamics基本オブジェクトクラス More...
 
struct  GxParamConeTwist
 ConeTwist設定パラメタ構造体 More...
 
struct  GxRayResult
 レイ判定情報 More...
 
struct  GxRigidBodyParam
 剛体パラメタ構造体 More...
 
class  GxWorld
 GxDynamics 基本ワールドクラス More...
 

Public Member Functions

初期化
 GxDynamics (void)
 デフォルトコンストラクタ
 
 ~GxDynamics (void) override
 デストラクタ
 
- Public Member Functions inherited from GxClassBase
constexpr GxClassBase (void)
 コンストラクタ
 
constexpr GxClassBase (const GxClassBase &base)
 コピーコンストラクタ
 
 ~GxClassBase (void) override
 デストラクタ
 
- Public Member Functions inherited from GxClassBaseRoot
constexpr GxClassBaseRoot (void)
 コンストラクタ
 
constexpr GxClassBaseRoot (const GxClassBaseRoot &)
 コピーコンストラクタ
 
virtual ~GxClassBaseRoot (void)
 デストラクタ
 
constexpr GxClassBaseRootoperator= (const GxClassBaseRoot &)
 代入演算子
 
virtual GxRttigetRtti (void) const =0
 Rttiの取得
 
virtual GX_FORCE_INLINE const GxTypedObjectgetDefaultObject (void)
 デフォルトオブジェクトを取得
 
GX_FORCE_INLINE b32 isDefaultObject (void)
 デフォルトオブジェクト判定
 

Protected Attributes

メンバ変数
b32 _active
 クラスを使用できるかフラグ
 
DYNAMICS_CALLBACK _pCallback
 後処理用コールバック
 
GxArrayClassBase _listObject
 オブジェクトのリスト
 
GxArrayClassBase _listConstraint
 拘束クラスのリスト
 
GxWorld_pRegisterWorld
 オブジェクトを登録するワールド
 
GxUnitBase_pUnit
 使用するユニット
 

定義

typedef void(GxClassBaseRoot::*) DYNAMICS_CALLBACK(void)
 後処理用コールバック
 
static const GxColor COLOR_OBJECT
 描画色
 
static constexpr u32 FLAG_ALL = 0x7fffffff
 全フラグ定数
 

操作

void clearList (void)
 全オブジェクト、拘束クラスをリストから削除する
 
virtual GX_FORCE_INLINE GxObjectallocObject (void)
 オブジェクトのメモリ確保
 
GxObjectgetObject (u32 index)
 指定インデックスのオブジェクトを取得
 
u32 getObjectCount (void)
 オブジェクトの数を取得
 
virtual void deleteObject (GxObject *pObject)
 オブジェクトを削除する
 
virtual void detachObject (GxObject *pObject)
 オブジェクトをリストから切り離す
 
virtual void detachConstraint (GxConstraint *pConstraint)
 拘束をリストから切り離す
 
GxObjectcreateSphere (b32 active, GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxShapeSphere &sphere, const GxRigidBodyParam &rigidParam, f32 margin=DYNAMICS_COLLISION_MARGIN)
 球の作成
 
GxObjectcreateBox (b32 active, GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxShapeBox &box, const GxRigidBodyParam &rigidParam, f32 margin=DYNAMICS_COLLISION_MARGIN)
 箱の作成
 
GxObjectcreateCylinder (b32 active, GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxShapeCylinder &cylinder, const GxRigidBodyParam &rigidParam, f32 margin=DYNAMICS_COLLISION_MARGIN)
 円柱の作成
 
GxObjectcreateMultisphere (b32 active, GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxShapeMultisphere &multisphere, const GxRigidBodyParam &rigidParam, f32 margin=DYNAMICS_COLLISION_MARGIN)
 マルチ球の作成
 
GxObjectcreateCapsule (b32 active, GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxShapeCapsule &capsule, const GxRigidBodyParam &rigidParam, f32 margin=DYNAMICS_COLLISION_MARGIN)
 カプセルの作成
 
virtual GxObjectcreateConvexShape (b32 active, GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxVector3 *pVertex, u32 numVertex, const GxRigidBodyParam &rigidParam, f32 margin)
 凸形状の作成
 
GxObjectcreateMesh (u32 index, b32 active, GxMatrixAffine *pMatrix, const GxVector3 &offset, const GxQuaternion &rotateOffset, const GxShapeTrimesh &trimesh, f32 friction=0.5f, b32 isCompress=true, GxVector3 *pAabbMin=nullptr, GxVector3 *pAabbMax=nullptr, f32 margin=DYNAMICS_COLLISION_MARGIN)
 背景用剛体の作成
 
GxObjectcreateCompoundObject (GxMatrixAffine *pMatrix, s32 jointIndex, const GxVector3 &offset, const GxQuaternion &rotateOffset, f32 margin=DYNAMICS_COLLISION_MARGIN)
 複合形状の作成
 
GX_FORCE_INLINE b32 isActive (void) const
 アクティブ判定
 
void setActive (b32 active)
 全剛体をアクティブにするか設定
 
virtual GxConstraintallocConstraint (void)
 拘束クラスのメモリ確保
 
GxConstraintgetConstraint (u32 index)
 指定インデックスの拘束クラスを取得
 
u32 getConstraintCount (void)
 拘束クラスの数を取得
 
virtual void deleteConstraint (GxDynamics::GxConstraint *pConstraint)
 拘束クラスを削除
 
GxConstraintcreateConstraintSpherical (b32 active, GxDynamics::GxObject *pObject0, GxDynamics::GxObject *pObject1, const GxVector3 &pivot0, const GxVector3 &pivot1, b32 disableCollisions=false)
 
GxConstraintcreateConstraintRevolute (b32 active, GxDynamics::GxObject *pObject0, GxDynamics::GxObject *pObject1, const GxMatrixAffine &matrix0, const GxMatrixAffine &matrix1, b32 disableCollisions=false)
 
GxConstraintcreateConstraintRevolute (b32 active, GxDynamics::GxObject *pObject0, GxDynamics::GxObject *pObject1, const GxVector3 &pivot0, const GxVector3 &pivot1, const GxVector3 &axis0, const GxVector3 &axis1, const GxVector3 &base0, const GxVector3 &base1, b32 disableCollisions=false)
 
GxConstraintcreateConstraintConeTwist (b32 active, GxDynamics::GxObject *pObject0, GxDynamics::GxObject *pObject1, const GxMatrixAffine &matrix0, const GxMatrixAffine &matrix1, const GxParamConeTwist &param)
 
GxConstraintcreateConstraintFixed (b32 active, GxDynamics::GxObject *pObject0, GxDynamics::GxObject *pObject1, const GxVector3 &pivot0, const GxVector3 &pivot1)
 固定タイプの拘束作成
 
virtual void initialize (GxDynamics::GxWorld *pRegisterWorld, GxUnitBase *pUnit, GxDynamics::DYNAMICS_CALLBACK, u32 threadIndex)
 初期設定
 
virtual void prepareCheck (void)
 当たり判定チェック前準備
 
virtual void preUpdate (void)
 更新前処理
 
virtual void postUpdate (void)
 更新後処理
 
void setActiveAll (b32 active)
 すべての剛体のアクティブ設定
 
constexpr GxWorldgetWorld (void) const
 登録ワールドの取得
 
GX_FORCE_INLINE void setCallback (DYNAMICS_CALLBACK pCallback)
 後処理用コールバック関数の設定
 
void executeCallback (void)
 後処理用コールバック関数の呼び出し
 
constexpr void setWorldNull (void)
 登録ワールドの削除
 
virtual GxObjectaddObject (void)
 オブジェクトの追加
 
GxConstraintaddConstraint (void)
 拘束クラスの追加
 

Additional Inherited Members

- Static Public Member Functions inherited from GxClassBaseRoot
static GX_FORCE_INLINE GxRtti__getStaticRtti (void)
 Rttiの取得
 

Detailed Description

物理演算クラス

Member Function Documentation

◆ addConstraint()

GxDynamics::GxConstraint * GxDynamics::addConstraint ( void )
protected

拘束クラスの追加

Returns
確保した拘束クラス
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addObject()

GxDynamics::GxObject * GxDynamics::addObject ( void )
protectedvirtual

オブジェクトの追加

Returns
確保したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocConstraint()

GxDynamics::GxConstraint * GxDynamics::allocConstraint ( void )
virtual

拘束クラスのメモリ確保

Returns
取得した拘束クラス
Here is the caller graph for this function:

◆ createBox()

GxDynamics::GxObject * GxDynamics::createBox ( b32 active,
GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxShapeBox & box,
const GxRigidBodyParam & rigidParameter,
f32 margin = DYNAMICS_COLLISION_MARGIN )

箱の作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのとき有効)
offset[in] オフセット
rotateOffset[in] 回転オフセット
box[in] 箱の形状
rigidParameter[in] 剛体パラメータ
margin[in] マージン
Returns
作成したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createCapsule()

GxDynamics::GxObject * GxDynamics::createCapsule ( b32 active,
GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxShapeCapsule & capsule,
const GxRigidBodyParam & rigidParameter,
f32 margin = DYNAMICS_COLLISION_MARGIN )

カプセルの作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのときに有効になる)
offset[in] マトリクスからのオフセット
rotateOffset[in] 回転オフセット
capsule[in] カプセル形状
rigidParameter[in] 剛体パラメータ
margin[in] マージン
Returns
確保したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createCompoundObject()

GxDynamics::GxObject * GxDynamics::createCompoundObject ( GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
f32 margin = DYNAMICS_COLLISION_MARGIN )

複合形状の作成

Parameters
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのときに有効になる)
offset[in] オフセット
rotateOffset[in] 回転オフセット
margin[in] マージン
Returns
確保したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createConstraintConeTwist()

GxDynamics::GxConstraint * GxDynamics::createConstraintConeTwist ( b32 active,
GxDynamics::GxObject * pObject0,
GxDynamics::GxObject * pObject1,
const GxMatrixAffine & matrix0,
const GxMatrixAffine & matrix1,
const GxParamConeTwist & parameter )

ConeTwistタイプの拘束クラス作成

Note
肩関節のようなコーン形状の可動範囲を持った、ねじりが可能な拘束です。
[Bullet]KINEMATICタイプを結合すると、関節部分が伸びてしまいます。
Parameters
active[in] 登録後すぐアクティブにするかどうか
pObject0[in] 拘束するオブジェクト1
pObject1[in] 拘束するオブジェクト2
matrix0[in] マトリクス1
matrix1[in] マトリクス2
parameter[in] 拘束設定パラメータ
Returns
作成した拘束クラス
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createConstraintFixed()

GxDynamics::GxConstraint * GxDynamics::createConstraintFixed ( b32 active,
GxDynamics::GxObject * pObject0,
GxDynamics::GxObject * pObject1,
const GxVector3 & pivot0,
const GxVector3 & pivot1 )

固定タイプの拘束作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pObject0[in] 拘束するオブジェクト0
pObject1[in] 拘束するオブジェクト1
pivot0[in] pObject0座標系での固定位置
pivot1[in] pObject1座標系での固定位置
Returns
作成した拘束クラス
Here is the call graph for this function:

◆ createConstraintRevolute() [1/2]

GxDynamics::GxConstraint * GxDynamics::createConstraintRevolute ( b32 active,
GxDynamics::GxObject * pObject0,
GxDynamics::GxObject * pObject1,
const GxMatrixAffine & matrix0,
const GxMatrixAffine & matrix1,
b32 disableCollisions = false )

回転軸タイプの拘束情報作成

Note
2つのオブジェクトを自由回転する軸でつなぐ、ヒンジのような拘束です。
[Bullet]KINEMATICタイプを結合すると、関節部分が伸びてしまいます。
Parameters
active[in] 登録後すぐアクティブにするかどうか
pObject0[in] 拘束するオブジェクト1
pObject1[in] 拘束するオブジェクト2
matrix0[in] マトリクス1
matrix1[in] マトリクス2
disableCollisions[in] true:pObject0とpObject1間のコリジョンを無視する
Returns
作成した拘束クラス
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createConstraintRevolute() [2/2]

GxDynamics::GxConstraint * GxDynamics::createConstraintRevolute ( b32 active,
GxDynamics::GxObject * pObject0,
GxDynamics::GxObject * pObject1,
const GxVector3 & pivot0,
const GxVector3 & pivot1,
const GxVector3 & axis0,
const GxVector3 & axis1,
const GxVector3 & base0,
const GxVector3 & base1,
b32 disableCollisions = false )

回転軸タイプの拘束情報作成(軸指定)

Note
2つのオブジェクトを自由回転する軸でつなぐ、ヒンジのような拘束です。
[Bullet]KINEMATICタイプを結合すると、関節部分が伸びてしまいます。
Parameters
active[in] 登録後すぐアクティブにするかどうか
pObject0[in] 拘束するオブジェクト0
pObject1[in] 拘束するオブジェクト1
pivot0[in] pObject0 での回転中心
pivot1[in] pObject1 での回転中心
axis0[in] pObject0 での回転軸
axis1[in] pObject1 での回転軸
base0[in] pObject0 の回転基準方向
base1[in] pObject1 の回転基準方向
disableCollisions[in] pObject0とpObject1間のコリジョンを無視するならtrue
Returns
作成した拘束クラス
Here is the call graph for this function:

◆ createConstraintSpherical()

GxDynamics::GxConstraint * GxDynamics::createConstraintSpherical ( b32 active,
GxDynamics::GxObject * pObject0,
GxDynamics::GxObject * pObject1,
const GxVector3 & pivot0,
const GxVector3 & pivot1,
b32 disableCollisions = false )

球タイプの拘束情報作成

Note
2つのオブジェクトを自由回転する点でつなぐ、ボールソケットのような拘束です。
[Bullet]KINEMATICタイプを結合すると、関節部分が伸びてしまいます。
Parameters
active[in] 登録後すぐアクティブにするかどうか
pObject0[in] 拘束するオブジェクト0
pObject1[in] 拘束するオブジェクト1(nullptrの場合、ワールドと拘束)
pivot0[in] pObject0での回転中心位置
pivot1[in] pObject1での回転中心位置
disableCollisions[in] pObject0とpObject1間のコリジョンを無視するならtrue
Returns
作成した拘束クラス
Here is the call graph for this function:

◆ createConvexShape()

GxDynamics::GxObject * GxDynamics::createConvexShape ( b32 active,
GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxVector3 * pVertex,
u32 countVertex,
const GxRigidBodyParam & rigidParameter,
f32 margin )
virtual

凸形状の作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのときに有効になる)
offset[in] マトリクスからのオフセット
rotateOffset[in] 回転オフセット
pVertex[in] 頂点群の先頭アドレス(Nxがいい感じにtriangleを生成するので、順番は考慮しなくてよい)
countVertex[in] 頂点数
rigidParameter[in] 剛体パラメータ
margin[in] マージン
Returns
確保したオブジェクト
Here is the call graph for this function:

◆ createCylinder()

GxDynamics::GxObject * GxDynamics::createCylinder ( b32 active,
GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxShapeCylinder & cylinder,
const GxRigidBodyParam & rigidParameter,
f32 margin = DYNAMICS_COLLISION_MARGIN )

円柱の作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのとき有効)
offset[in] マトリクスからのオフセット
rotateOffset[in] 回転オフセット
cylinder[in] 円柱の形状
rigidParameter[in] 剛体パラメータ
margin[in] マージン
Returns
作成したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createMesh()

GxDynamics::GxObject * GxDynamics::createMesh ( u32 index,
b32 active,
GxMatrixAffine * pMatrix,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxShapeTrimesh & trimesh,
f32 frict = 0.5f,
b32 isCompress = true,
GxVector3 * pAabbMin = nullptr,
GxVector3 * pAabbMax = nullptr,
f32 margin = DYNAMICS_COLLISION_MARGIN )

背景用剛体の作成

Parameters
index[in] 背景当たりインデックス
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
offset[in] マトリクスからのオフセット
rotateOffset[in] 回転オフセット
trimesh[in] 三角形メッシュ形状
pBtVertex[in] Bulletのメッシュのデータ
frict[in] 摩擦係数(デフォルト 0.5f)
isCompress[in] データを圧縮するかどうか(default = true)
pAabbMin[in] メッシュを囲むAABBボックスの最小値
pAabbMax[in] メッシュを囲むAABBボックスの最大値
margin[in] マージン
Returns
作成したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createMultisphere()

GxDynamics::GxObject * GxDynamics::createMultisphere ( b32 active,
GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxShapeMultisphere & capsule,
const GxRigidBodyParam & rigidParameter,
f32 margin = DYNAMICS_COLLISION_MARGIN )

マルチ球の作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのとき有効)
offset[in] マトリクスからのオフセット
rotateOffset[in] 回転オフセット
capsule[in] カプセルの形状
rigidParameter[in] 剛体パラメータ
margin[in] マージン
Returns
作成したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createSphere()

GxDynamics::GxObject * GxDynamics::createSphere ( b32 active,
GxMatrixAffine * pMatrix,
s32 jointIndex,
const GxVector3 & offset,
const GxQuaternion & rotateOffset,
const GxShapeSphere & sphere,
const GxRigidBodyParam & rigidParameter,
f32 margin = DYNAMICS_COLLISION_MARGIN )

球の作成

Parameters
active[in] 登録後すぐアクティブにするかどうか
pMatrix[in] 引っ付けるマトリクス
jointIndex[in] 関節番号(pMatrixがnullptrのとき有効)
offset[in] オフセット
rotateOffset[in] 回転オフセット
sphere[in] 球の形状
rigidParameter[in] 剛体パラメータ
margin[in] マージン
Returns
作成したオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteConstraint()

void GxDynamics::deleteConstraint ( GxDynamics::GxConstraint * pConstraint)
virtual

拘束クラスを削除

Parameters
pConstraint[in] 削除したい拘束クラス
Here is the call graph for this function:

◆ deleteObject()

void GxDynamics::deleteObject ( GxDynamics::GxObject * pObject)
virtual

オブジェクトを削除する

Parameters
pObject[in] 削除したいオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ detachConstraint()

void GxDynamics::detachConstraint ( GxDynamics::GxConstraint * pConstraint)
virtual

拘束をリストから切り離す

Parameters
pConstraint[in] 拘束
Here is the call graph for this function:
Here is the caller graph for this function:

◆ detachObject()

void GxDynamics::detachObject ( GxDynamics::GxObject * pObject)
virtual

オブジェクトをリストから切り離す

Parameters
pObject[in] 切り離したいオブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getConstraint()

GxDynamics::GxConstraint * GxDynamics::getConstraint ( u32 index)

指定インデックスの拘束クラスを取得

Parameters
index[in] 取得したい拘束クラスのインデックス

◆ getConstraintCount()

u32 GxDynamics::getConstraintCount ( void )

拘束クラスの数を取得

Returns
拘束クラス数
Here is the call graph for this function:

◆ getObject()

GxDynamics::GxObject * GxDynamics::getObject ( u32 index)

指定インデックスのオブジェクトを取得

Parameters
index[in] 取得したいオブジェクトのインデックス
Returns
オブジェクト
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObjectCount()

u32 GxDynamics::getObjectCount ( void )

オブジェクトの数を取得

Returns
オブジェクト数
Here is the call graph for this function:

◆ initialize()

void GxDynamics::initialize ( GxDynamics::GxWorld * pRegisterWorld,
GxUnitBase * pUnit,
GxDynamics::DYNAMICS_CALLBACK pCallback,
u32 threadIndex )
virtual

初期設定

Parameters
pRegisterWorld[in] 登録先ワールド
pUnit[in] 使用するユニット
pCallback[in] 呼び出すコールバック関数
threadIndex[in] スレッドインデックス
Here is the call graph for this function:
Here is the caller graph for this function:

◆ postUpdate()

void GxDynamics::postUpdate ( void )
virtual

更新後処理

Note
物理演算のワールド更新を行った後に呼ばれる。 物理演算の計算結果を、ユニットに渡す。
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preUpdate()

void GxDynamics::preUpdate ( void )
virtual

更新前処理

Note
物理演算のワールド更新を行う前に呼ばれる。 ポジション、クォータニオン、スケールをユニットから受け取って物理演算用剛体に反映させる
Here is the caller graph for this function:

◆ setActive()

void GxDynamics::setActive ( b32 active)

全剛体をアクティブにするか設定

Parameters
active[in] 登録している全剛体をアクティブにするならtrue
Here is the caller graph for this function:

◆ setActiveAll()

void GxDynamics::setActiveAll ( b32 active)

すべての剛体のアクティブ設定

Parameters
active[in] アクティブにするならtrue
Here is the call graph for this function:

The documentation for this class was generated from the following files: