-
davidt2115
-
-
-
Joined on 07-13-2008
-
-
Posts 10
-
-
|
simple character controller
I have got havok working nicely in my engine, but now I
am having some trouble getting a simple character controller working. I read
the part about it in the documentation and understand it but then went into the
demo code and was very confused. I think it was all of the extra stuff and the
way the demo does things like getting input, and extra things that I don’t need
right now. I could defiantly use a bare bones rigid body character controller
that simply walks around. if someone could please show me how to do this in the
simplest way possible would be a great help.
Thanks, David
|
|
| |
-
benny53
-
-
-
Joined on 05-31-2008
-
Ohio
-
Posts 67
-
-
|
Re: simple character controller
Well it may not be an example, but this thread I had just posted holds the initiation and update method of my character controller. Although, thats only if you don't want jumping right now as something is slightly wrong in that code. If you wanna wait a bit I could probably put together a bare bones character controller demo using direct3d or something.
|
|
| |
|
|
Re: simple character controller
Hi David,
Unfortunately the ControlCharacterRbDemo does a lot and I guess it can seem quite convoluted. Here are the parts you need:
For setup, look at lines 201 to 265. This creates the shape, rigid body, controller, states, and context. All these are necessary. You could cut out states you don't intend to use, such as climbing, but that wouldn't simplify it very much.
The next bit of relevant code is the code which must be done every frame. This is from lines 300 to 463 and 497 to 539.
Parts of this code that aren't necessary for a simple character controller with no climbing/crouching and just walks and jumps around are:
309 to 337, and 366 to 382 is for ladder-climbing can be ignored if you don't need ladder support. 393 to 438 is just a performance tweak and can be ignored.
497 to 539 can be ignored if you don't need crouching.
After removing these parts of code that's about as simple as you'll get a rigid body character controller. The hkpCharacterInput is necessary to calculate the next position/state of the controller and hkpCharacterOutput is necessary to move your rigid body to its next position.
I think that's about as simple as we can get it. Please feel free to ask any questions you have about what's going on and I'll do my best to help you figure it out.
Thanks, Daniel
|
|
| |
-
davidt2115
-
-
-
Joined on 07-13-2008
-
-
Posts 10
-
-
|
Re: simple character controller
could you put together all the code I need it to run together. so that the creation/initialization, variable definitions, and update code are separated. and if you could show me what to change when I get a keyboard message, like if(key == W) { move forward } because i tryed to get the code from the demo and could not get it to work. so if you could please post the code and all the things I need for it to work(includes, variable definitions, Initilization, updating) all seperated so i can copy and past into my engine so that I dont have to worry about geting bits and pecies and putting it together and getting it to work.
Thanks, David.
|
|
| |
|
|
Re: simple character controller
David,
Please look at benny53's code to see how he deals with those key events.
Thanks, Daniel
|
|
| |
-
davidt2115
-
-
-
Joined on 07-13-2008
-
-
Posts 10
-
-
|
Re: simple character controller
ok, but I still cant get it to work, could you post what code I need with what variables and includes I need so that I can understand the bare minumum that I need for it to work.
Thanks, David
|
|
| |
|
|
Re: simple character controller
Hi David,
I'm afraid I'm not familiar with your engine so there's nothing I can write that you can just copy and paste in, but if you look through that code I directed you to, I'm sure you can understand which parts do what, and where you need to modify your engine's code.
Thanks, Daniel
|
|
| |