MovingSupportRB Demo: What is the m_bodyType map used for?

MovingSupportRB Demo: What is the m_bodyType map used for?

Hi,I've got a moving platform which moves using a spring. It's dynamic, and when the character (rigidbody) controller stands on it, the CC does not move with it. So I looked at the demo, and it's fine except for the m_bodyType map, what is it for, and do I need to build one containing every body in my world?Population:

for ( int j = 0; j < NUM_OF_ROWS; ++j )



m_world->addEntity( body );

m_bodyType.insert( body, j % 2 );

m_bodies.pushBack( body );

Use with dyanamic bodies in getGround();
for ( int i = 0; i < numSupportInfo; ++i )


		const hkpCharacterRigidBody::SupportInfo& support = supportInfo[i];
		if ( bool(m_bodyType.getWithDefault( support.m_rigidBody, false )) )


			// Apply the impulse at the contact point.

			support.m_rigidBody->applyPointImpulse( impulse,   support.m_point.getPosition() );



2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Hey edcampion,

By default, the character rigid body
controller ignores the velocity of dynamic surfaces. This is because when a
character stands on a dynamic body it is possible it will move its supporting
surface. Because motion is defined as relative to the this surface, this may
cause a feedback loop, where the character moves the dynamic surface, which
moves the character, which further moves the surface.

The m_bodyType map in the
MovingSupportRbDemo is used to store whether or not the character rigid body
controller should use the default behavior (shown on the cyan bodies) or take
into account the velocity of the dynamic surfaces (shown with the yellow
bodies). The map allows the controller to determine this ono a per-body

The default implementation of
hkpCharacterRigidBody::getGround() doesn't determine whether or not to use the
velocities of dynamic surfaces on a per-body basis. Instead, it takes a boolean
argument that determines whether all dynamic surface velocities are used.

More information can be found in the
Product Manual in:
Physics->Extensions->Character Control->The Character Rigid Body

Because of the feedback loop described
previously, you may need to take extra steps to ensure a more accurate response
from the dynamic bodies. These steps can be observed at the end of
MovingSupportRbDemo::getGround() where an impulse is applied to these bodies.

Hope that helps!


Nick S.
Developer Support Engineer

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi