changing character speed

jchmack

09-01-2007 03:32:20

How do i slow down the speed of a character? Ive tried changing the step size and scaling down its movement vector but they seem to go at the same speed...

DaCracker

09-01-2007 07:25:41

Decrease the values in the method nxOgre::character::move().
For e.g:

mNextMovement.z = -0.5; // (instead of -1)

Do this in all directions and you''ve got a speed
decreased by half :)

jchmack

09-01-2007 08:13:15

Decrease the values in the method nxOgre::character::move().
For e.g:

mNextMovement.z = -0.5; // (instead of -1)

Do this in all directions and you''ve got a speed
decreased by half :)


ok im trying this:
mPlayer->mNextMovement *= .5;

and nothing is happening... Shouldn't this decrease the movements in any direction by 50%?

edit:

even this doesn't stop him:
mPlayer->mNextMovement= Vector3(0,0,0);

betajaen

09-01-2007 09:19:01

Yes, but what is 50% of 0? It's 0.

jchmack

09-01-2007 15:46:31

Yes, but what is 50% of 0? It's 0.

yes but when i am moving shouldn't this vector be a value? And this should reduce it to 50%.

edit: Bah i got it i wasn't calling it every frame just some of the frames. Thx for the help =)

ocrim74

15-01-2007 18:45:02

Hi,

I tried to inherit the character class to create my own or overloaded methods of my own. To set the speed I want to create my own setSpeed()-method without changing the original nxOgre-library. In the character class the constructor is declared as private so that I can not use it. For testing I declared the constructor as proteced and it works, but I donĀ“t want to change the library.

Now I try to inherit the blueprint<character> class. I am not sure which way would be the best. In the first steps I got problems. May be it is not so easy to inherit from a template.

Do you have any ideas? I am trying to take a way that is correct from the point of the archtectural view.

Thanks in advance,

ocrim74