hkpDynamics->hkpRigidBody

来源:互联网 发布:java oa 工作流 编辑:程序博客网 时间:2024/06/11 17:22

hkpRigidBody类查询

 

这是个基础的刚体类。

hkpRigidBody继承图:


公有成员函数

hkpRigidBody (const hkpRigidBodyCinfo&info)

构造函数从传递的参数获取信息

这包含创建一个有效刚体需要的所有信息

virtual ~hkpRigidBody ()

默认的析构函数

在调试时这个函数检查多线程访问标记:多线程访问需要:

getWorld() - HK_ACCESS_IGNORE

this -HK_ACCESS_RW

void getCinfo (hkpRigidBodyCinfo &info) const 

从这个刚体获得结构信息

hkpRigidBody (class hkFinishLoadedObjectFlagflag)

构造函数被Havok序列化使用

hkReal getMass () const 

获得刚体的质量

hkReal getMassInv () const 

获得刚体的1.0/质量

void  setMass (hkReal m)

设置刚体的质量

void  setMassInv (hkReal mInv)

设置刚体的质量

void  getInertiaLocal (hkMatrix3 &inertiaOut)const 

在本地空间获取惯性张量(在重心周围)  

void  getInertiaWorld (hkMatrix3 &inertiaOut)const 

在世界空间获取惯性张量(在重心周围)    

void  setInertiaLocal (const hkMatrix3&inertia)

设置刚体的惯性张量

void  setInertiaInvLocal (const hkMatrix3&inertiaInv)

Sets theinertia tensor of the rigid body by supplying its inverse. More...

设置刚体的惯量张量提供其反。  

void  getInertiaInvLocal (hkMatrix3&inertiaInv) const 

在本地空间获取逆惯性张量

void  getInertiaInvWorld (hkMatrix3&inertiaInvOut) const 

在世界空间获取逆惯性张量

void  setCenterOfMassLocal (const hkVector4&centerOfMass)

在本地空间显式设置刚体的重心 

consthkVector4 &  getCenterOfMassLocal ()const 

在本地空间获得刚体的重心 

consthkVector4 &  getCenterOfMassInWorld() const 

在世界空间获得刚体的重心    

consthkVector4 &  getPosition ()const 

在世界空间中返回刚体的位置(the local space origin)

void  setPosition (const hkVector4 &position)

在世界空间中设置刚体的位置(the local space origin)

consthkQuaternion &  getRotation ()const 

返回从本地到世界空间的刚体的旋转

void  setRotation (const hkQuaternion&rotation)

设置从本地到世界空间的刚体的旋转

void  setPositionAndRotation (const hkVector4&position, const hkQuaternion &rotation)

在世界空间中设置刚体的位置和旋转

consthkTransform &  getTransform ()const 

返回刚体(本地)到世界的变换

void  setTransform (const hkTransform&transform)

设置刚体(本地)到世界的变换 

void  setPositionAndRotationAsCriticalOperation(const hkVector4 &position, const hkQuaternion &rotation)

像setPositionAndRotation, 如果hkpWorld被锁,它的影响将被延迟 

void  approxTransformAt (hkTime time, hkTransform&transformOut) const 

Interpolatethe matrix for the 'time' time; for asynchronous simulation only. More... 

void  approxCurrentTransform (hkTransform &transformOut)const 

Approximatesthe body's transform at the current world's time.    

consthkVector4 &  getLinearVelocity ()const 

返回在世界空间中的刚体质心的线速度

void  setLinearVelocity (const hkVector4&newVel)

设置在世界空间中的刚体质心的线速度

consthkVector4 &  getAngularVelocity ()const 

返回在世界空间中的刚体质心的角速度

void  setAngularVelocity (const hkVector4&newVel)

设置在世界空间中的刚体质心的角速度

void  getPointVelocity (const hkVector4 &p,hkVector4 &vecOut) const 

获得在世界空间刚体上的点p的速度

void  setLinearVelocityAsCriticalOperation (consthkVector4 &newVel)

像setLinearVelocity,但是如果世界被锁影响将延迟

void  setAngularVelocityAsCriticalOperation (consthkVector4 &newVel)

像setAngularVelocity, 但是如果世界被锁影响将延迟

void  applyLinearImpulse (const hkVector4 &imp)

给重心作用一个冲量 (在世界空间中) 

void  applyPointImpulse (const hkVector4 &imp,const hkVector4 &p)

给点p作用一个冲量 (在世界空间中) 

void  applyAngularImpulse (const hkVector4&imp)

在重心周围作用一个瞬时角速度的变化

如果它是非活动,这将激活身体及其仿真岛。

void  applyLinearImpulseAsCriticalOperation (consthkVector4 &imp)

applyLinearImpulse的World-lock–safe版本

void  applyPointImpulseAsCriticalOperation (consthkVector4 &imp, const hkVector4 &p)

applyPointImpulse的World-lock–safe版本

void  applyAngularImpulseAsCriticalOperation (consthkVector4 &imp)

applyAngularImpulse的World-lock–safe版本

void  applyForce (const hkReal deltaTime, consthkVector4 &force)

对于给定的时间间隔给刚体作用一个力(在世界空间中) 

void  applyForce (const hkReal deltaTime, consthkVector4 &force, const hkVector4 &p)

对于给定的时间间隔给刚体的点p作用一个力(在世界空间中)     

void  applyTorque (const hkReal deltaTime, consthkVector4 &torque)

对于给定的时间间隔给刚体作用一个指定的转矩(在世界空间中)   

hkReal  getLinearDamping () const 

Naive动力阻尼   

void  setLinearDamping (hkReal d)

Naive动力阻尼

hkReal  getAngularDamping () const 

Naive动力阻尼

void  setAngularDamping (hkReal d)

Naive动力阻尼

hkReal  getTimeFactor () const 

时间系数

void  setTimeFactor (hkReal f)

时间系数

hkReal  getGravityFactor (void) const 

Gravityscaling accessor.   

void  setGravityFactor (hkReal f)

重力缩放变换   

hkReal  getMaxLinearVelocity () const 

获取此刚体的上限线速度

void  setMaxLinearVelocity (hkReal maxVel)

设置最大线速度

hkReal  getMaxAngularVelocity () const 

获取此刚体的上限角速度

void  setMaxAngularVelocity (hkReal maxVel)

设置最大角速度

void  enableDeactivation (bool _enableDeactivation)

为该刚体启用或禁用失活

bool  isDeactivationEnabled () const 

检查失活是否启用

hkUint32  getCollisionFilterInfo () const 

获取碰撞筛选器信息

void  setCollisionFilterInfo (hkUint32 info)

设置碰撞过滤器信息

hkpCollidableQualityType  getQualityType () const 

在调试时此函数检查多线程访问标记

void  setQualityType (hkpCollidableQualityTypetype)

设置碰撞的质量类型

hkReal  getAllowedPenetrationDepth () const  

获取当前允许穿透深度

void  setAllowedPenetrationDepth (hkReal val)

设置当前允许穿透深度

void setMotionType (hkpMotion::MotionType newState, hkpEntityActivationpreferredActivationState=HK_ENTITY_ACTIVATION_DO_ACTIVATE,hkpUpdateCollisionFilterOnEntityMode collisionFilterUpdateMode=HK_UPDATE_FILTER_ON_ENTITY_FULL_CHECK)

改变运动类型。

运动类型可以是固定的,关键帧或动态的。在更改到关键帧或动态时,您应该指定适当的激活状态(行为类推到addEntity (entity, activationState)。您可以选择执行一个完整的粗测阶段查询检查是否应创建新的代理或决定只验证目前代理的有效性。当固定身体时,后者选项非常有用,我们知道,我们将只移除有其他固定或关键帧身体的碰撞代理。

重要:更改到固定或关键帧状态或从固定或关键帧状态更改时此函数更新刚体的hkpCollidableQualityType。在运动类型从动态运动被改变时,原刚体的质量类型存储在新的关键帧运动,取而代之的是一个适当的固定/关键帧质量。When a body is then changed back to its dynamic state, its original quality type is restored (along with its also-stored original dynamic motion). Similarly, when changing a motion's type from dynamic to fixed or keyframed, the original dynamic motion's data is saved and can be later restored when the motion's type is switched back to dynamic.

Note that this doesn't recreate agents (and doesn't switch between their predictive and non-predictive versions), therefore having two non-continuously colliding dynamic objects, and fixing one of them, doesn't result in continuous collision detection, between the objects if the agent is already created. The current agent will be replaced by its continuous version only after the bodies separate and loose their broadphase overlap (when their agent is destroyed) and then come into proximity again (creating a new agent of type conforming to their current qualityType settings).

  • Fixed (hkpMotion::MOTION_FIXED) entities are unmovable and effectively have infinite mass.
  • Keyframed (hkpMotion::MOTION_KEYFRAMED) entities can have their kinematics explicitly altered, but ignore external impulses and forces e.g., from collisions or actions.
  • Dynamic (e.g., hkpMotion::MOTION_DYNAMIC, hkpMotion::MOTION_BOX_INERTIA) entities are affected by external forces and impulses.

For keyframed and fixed types there is some special treatment. To see whether a keyframed/fixed body has been changed from a dynamic state, usehkpRigidBody::getStoredDynamicMotion().

注意:如果一个对象被创建为关键帧或固定以后将无法更改为动态的,但动态对象可以更改为固定或关键帧。
注意:当一个身体是关键帧时,其速度是零。其变换和质心被保存。It is expected that should a user wish to transfer velocities during such a transition they can get and set as necessary usinggetLinearVelocity(), getAngularVelocity() and setLinearVelocity(), setAngularVelocity().This means that passing hkpMotion::MOTION_FIXED to setMotionType() will "stop" a body, but not move it. When a body is "unkeyframed" by passinghkpMotion::MOTION_DYNAMIC to setMotionType() it preserves both the transform and velocities of the current motion, as well as its original center of mass. It effectively continues on from the same position and with the same velocity that it had just prior to being "unkeyframed" but is now under dynamic control. All position and velocity information stored at the point in time when the body was actually "made" keyframed are lost, it is overwritten with the current values. Fixed bodies' velocities will always be zeroed. In debug this function checks multithreaded access markers. Multithreaded access required:

hkpMotion::MotionType  getMotionType () const 

返回身体的运动类型

hkpMotion*  getStoredDynamicMotion ()

If therigid body has been "set" to be keyframed, by passing hkpMotion::MOTION_KEYFRAMEDto setMotionType(), this allows you to get the original dynamic motion (whichis stored), and hence get the "unkeyframed" mass and inertia of therigid body. More...   

consthkpMotion *  getStoredDynamicMotion ()const 

上述的常量版本  

void  updateCachedShapeInfo (const hkpShape *shape,hkVector4 &extentOut)

更新缓存的基于形状的刚体运动信息。它还返回范围(AABB的大小)。   

hkReal  getFriction () const 

从材料返回摩擦系数(动态和静态)

hkReal  getRollingFrictionMultiplier () const 

滚动摩擦是过程中的work

 

 

hkReal  getRestitution () const 

从材料返回默认的恢复形变

void  setFriction (hkReal newFriction)

设置材料的摩擦系数

void  setRollingFrictionMultiplier (hkRealmultiplier)

滚动摩擦是过程中的work

void  setRestitution (hkReal newRestitution)

设置材料的恢复形变系数

hkWorldOperation::Result  setShape (const hkpShape *shape)

设置形状并重新计算缓存数据

hkWorldOperation::Result  updateShape (hkpShapeModifier*shapeModifier=HK_NULL)

更新内部形状相关的缓存和碰撞代理

virtualhkpRigidBody *  clone () const 

Given arigidbody (this), return a new rigidbody that shares all static data such asthe shapes, but clones the dynamic runtime data such as the current motions anduser defined properties. More... 

hkpMotion*  getRigidMotion () const    

hkBool  checkPerformance () const 

 

公有成员函数从hkpEntity

公有成员函数从hkpWorldObject

公有成员函数从hkpReferencedObject

公有成员函数从hkpBaseObject

 

静态公有成员函数

staticvoid  createDynamicRigidMotion(hkpMotion::MotionType motionType, const hkVector4 &position, consthkQuaternion &rotation, hkReal mass, const hkMatrix3 &inertiaLocal,const hkVector4 &centreOfMassLocal, hkReal maxLinearVelocity, hkRealmaxAngularVelocity, hkpMaxSizeMotion *motionBufferOut)

内部函数,被hkpWorldOperationUtil::setRigidBodyMotionType()调用

staticvoid updateBroadphaseAndResetCollisionInformationOfWarpedBody (hkpEntity *entity)

在调试时此函数检查多线程访问标记

 

静态公有成员函数从hkpReferencedObject

 

保护成员函数

virtualhkMotionState *  getMotionState ()

在调试时此函数检查多线程访问标记

 

保护成员函数从hkpEntity

保护成员函数从hkpWorldObject

保护成员函数从hkpReferencedObject

 

其他继承的成员


详细说明

 

这是个基础的刚体类。

 

刚体是其形状不变的对象。他们是Havok动力的核心,因为它们容易允许迅速的实时物理仿真。一个hkpRigidBody包装存储有关刚体如何移动的所有信息的hkpMotion,包括它的质量和速度。它也有一个hkpCollidable成员,其包含身体和碰撞检测系统工作的所需要信息,例如它的hkpShape.



0 0
原创粉丝点击