Change jump height and forward\\strafe velocity

Change jump height and forward\\strafe velocity

I'm trying to change jump height without success, using 10.0f or 1000.0f i get the same height.
This is what i did to change the jump height:

((hkpCharacterStateJumping*)state)->setJumpHeight(1000.0f);

The same happens with the forward\\backward\\strafe velocity, if i use m_inputUD= 100.0f or 1.0f i get the same velocity.

What do i need to change the jump and walk velocity?

5 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hi,

To set the walking speed you can use hkpCharacterStateOnGround::setSpeed(...).
m_inputUD is a value between -1 and 1 that signifies a joystick up/down axis value for control input.

The code you've listed is the correct way to change the jump height (I can vertify it works within the demo framework), so I'm not sure why it's not working.

When are you calling it?
Maybe post your character state machine creation code.

Cormac

Hi, thanks for the quick reply.
Here is the code:

// Create the Character state machine and context
	{
		hkpCharacterState* state;
		hkpCharacterStateManager* manager = new hkpCharacterStateManager();

		state = new hkpCharacterStateOnGround();
		manager->registerState( state,	HK_CHARACTER_ON_GROUND);
		state->removeReference();

		state = new hkpCharacterStateInAir();
		manager->registerState( state,	HK_CHARACTER_IN_AIR);
		state->removeReference();

		state = new hkpCharacterStateJumping();
		((hkpCharacterStateJumping*)state)->setJumpHeight(500.0f);
		manager->registerState( state,	HK_CHARACTER_JUMPING);
		state->removeReference();

		state = new hkpCharacterStateClimbing();
		manager->registerState( state,	HK_CHARACTER_CLIMBING);
		state->removeReference();

		m_characterContext = new hkpCharacterContext( manager, HK_CHARACTER_ON_GROUND );
		manager->removeReference();

		// Set character type
		m_characterContext->setCharacterType(hkpCharacterContext::HK_CHARACTER_RIGIDBODY);
	}

and if you need the rest of my code see this post:

http://software.intel.com/en-us/forums/showthread.php?t=86548&o=a&s=lr

Thanks!

I finally found the problem and it's nothing to do with that code, it's a scale problem.
Ogre has a ver big scale and my character had 60 units tall, since Havok 1 unit = 1 meter, my player had 60 meters tall and the level map was even bigger.
After rescaling them, all the changes i make in speed and jump height are visible.

Thanks for the help anyway.

Glad that's working, and thanks for posting your solution.

It might help for someone else with a similar problem - scale problems are easy to overlook.

Cormac

Connectez-vous pour laisser un commentaire.