I am having difficulty showing a hkpCharacterProxy in the visual debugger. The other shapes such as capsules and box are showing fine in both dynamic and static behavior.
My question is: Do I need to do anything special to show the phantom of my hkpCharacterProxy? Here is the initialization of my Character.
void
Solution:
My teacher showed me Viewers -> Phantom in the visual debugger. It does not show by default it seems.
init()
{
hkpWorld* world = HavokCore::GetInstance().GetWorld();
//world->markForWrite();
//world->lock()
hkVector4 vertexA(0,0, 0.4f);
hkVector4 vertexB(0,0,-0.4f);
standShape_ =
newhkpCapsuleShape(vertexA, vertexB, 0.6f);
vertexA.setZero4();
crouchShape_ =
newhkpCapsuleShape(vertexA, vertexB, 0.6f);
phantom_ =
newhkpSimpleShapePhantom( standShape_, hkTransform::getIdentity(), hkpGroupFilter::calcFilterInfo(0,2) );
world->addPhantom(phantom_)->removeReference();
hkpCharacterProxyCinfo cpci;
cpci.m_position = tempPosition_;
cpci.m_staticFriction = 0.0f;
cpci.m_dynamicFriction = 1.0f;
cpci.m_up.setNeg4( world->getGravity() );
cpci.m_up.normalize3();
cpci.m_userPlanes = 4;
cpci.m_maxSlope = HK_REAL_PI / 3.f;
cpci.m_shapePhantom = phantom_;
characterProxy_ =
newhkpCharacterProxy( cpci );
listener_ =
newCharacterLadderListener();
characterProxy_->addCharacterProxyListener(listener_);
hkpCharacterState* state;
hkpCharacterStateManager* manager =
newhkpCharacterStateManager();
state =
newhkpCharacterStateOnGround();
manager->registerState( state, HK_CHARACTER_ON_GROUND);
state->removeReference();
state =
newhkpCharacterStateInAir();
manager->registerState( state, HK_CHARACTER_IN_AIR);
state->removeReference();
state =
newhkpCharacterStateJumping();
manager->registerState( state, HK_CHARACTER_JUMPING);
state->removeReference();
state =
newhkpCharacterStateClimbing();
manager->registerState( state, HK_CHARACTER_CLIMBING);
state->removeReference();
characterContext_ =
newhkpCharacterContext(manager, HK_CHARACTER_ON_GROUND);
manager->removeReference();
currentAngle_ = HK_REAL_PI * 0.5f;
//world->unlock();
//world->unmarkForWrite();
}
[SOLVED] Havok Visual Debugger with hkpCharacterProxy
Hi,
I am having difficulty showing a hkpCharacterProxy in the visual debugger. The other shapes such as capsules and box are showing fine in both dynamic and static behavior.
My question is: Do I need to do anything special to show the phantom of my hkpCharacterProxy? Here is the initialization of my Character.
void Solution: My teacher showed me Viewers -> Phantom in the visual debugger. It does not show by default it seems. init() { hkpWorld* world = HavokCore::GetInstance().GetWorld(); //world->markForWrite(); //world->lock() hkVector4 vertexA(0,0, 0.4f); hkVector4 vertexB(0,0,-0.4f); standShape_ = newhkpCapsuleShape(vertexA, vertexB, 0.6f); vertexA.setZero4(); crouchShape_ = newhkpCapsuleShape(vertexA, vertexB, 0.6f); phantom_ = newhkpSimpleShapePhantom( standShape_, hkTransform::getIdentity(), hkpGroupFilter::calcFilterInfo(0,2) ); world->addPhantom(phantom_)->removeReference(); hkpCharacterProxyCinfo cpci; cpci.m_position = tempPosition_; cpci.m_staticFriction = 0.0f; cpci.m_dynamicFriction = 1.0f; cpci.m_up.setNeg4( world->getGravity() ); cpci.m_up.normalize3(); cpci.m_userPlanes = 4; cpci.m_maxSlope = HK_REAL_PI / 3.f; cpci.m_shapePhantom = phantom_; characterProxy_ = newhkpCharacterProxy( cpci ); listener_ = newCharacterLadderListener(); characterProxy_->addCharacterProxyListener(listener_); hkpCharacterState* state; hkpCharacterStateManager* manager = newhkpCharacterStateManager(); state = newhkpCharacterStateOnGround(); manager->registerState( state, HK_CHARACTER_ON_GROUND); state->removeReference(); state = newhkpCharacterStateInAir(); manager->registerState( state, HK_CHARACTER_IN_AIR); state->removeReference(); state = newhkpCharacterStateJumping(); manager->registerState( state, HK_CHARACTER_JUMPING); state->removeReference(); state = newhkpCharacterStateClimbing(); manager->registerState( state, HK_CHARACTER_CLIMBING); state->removeReference(); characterContext_ = newhkpCharacterContext(manager, HK_CHARACTER_ON_GROUND); manager->removeReference(); currentAngle_ = HK_REAL_PI * 0.5f; //world->unlock(); //world->unmarkForWrite(); }