Character Movement

mcaden

01-10-2008 10:39:24

Having some issues that I'm not sure how to resolve.

I'm using NxOgre '22 test (same problems though occur with '21 so the fact that I'm using unstable isn't an issue).


  1. General Movement
    1. If I use addForce(...) my movement speed is changed based on framerate[/*:m]
    2. If I use setLinearVelocity(...) I cancel out other movement[/*:m][/list:o][/*:m]
    3. Orientation - My character should never fall over. This can be achieved by locking the X and Z axes, but in doing so causes major turning when the terrain is at a slant.[/*:m]
    4. Gravity - My character floats. I can force him down by adding extra downward force However:
      1. This feels like a dirty solution to me[/*:m]
      2. Causes extra force issues in grinding character into the ground[/*:m]
      3. Gets canceled out if I use the "setLinearVelocity" form of movement listed above[/*:m]
      4. Again, falling speed would be dependent on framerate[/*:m][/list:o][/*:m]
      5. Jumping
        1. When I do reset?
          1. When I touch ground? Ground would have to be separate from walls (only an issue since I'm using a cave environment I suppose). [/*:m]
          2. What about when I'm on top of an object? (I landed on a crate or rock) Can't reset purely on touch, must actually be on the object[/*:m]
          3. Check linearVelocity going downward? But what about when you've reached the peak of a jump, your velocity would be 0 and you'd simply be able to jump again[/*:m][/list:u][/*:m]
          4. If jumping is only when you press the button, what about falling off objects? Shouldn't be able to jump mid-air from a fall[/*:m][/list:o][/*:m][/list:o]


            Has anybody solved these problems in a clean, stable way?

mcaden

01-10-2008 15:36:19

I'm beginning to thing using NxOgre is a mistake for my project.


I want to have:
  1. semi-realistic gravity[/*:m]
  2. believable character movement[/*:m]
  3. collisions based on actor(body) type[/*:m]
  4. have objects react to force initiated by my character and other objects[/*:m]
  5. have my character react to forces initiated by other objects[/*:m][/list:o]

    4 and 5 work beautifully
    3 is in the pipe to be in revision 22 which isn't ready yet

    1 and 2 seem to be something NxOgre is severely lacking

    I'm thinking a good part of my character movement problem might be possible with a system like this one for ODE -> http://www.ogre3d.org/wiki/index.php/Og ... _Character <- but I haven't tried to implement that in NxOgre quite yet.

betajaen

01-10-2008 15:55:08

Let's go through your list:

1. Remember NxOgre is just a wrapper, so it doesn't do gravity - it merely enables it.

2. That's your department. You seem to be using a normal actor, I would use a kinematic one. Use setLinearVelocity instead of forces, to smooth out the movement.

3. I'm not sure what you mean by this? Are you referring to identifying actors by their body type? Because Actor does have this.

mcaden

01-10-2008 16:10:32

1. But gravity isn't really working...I'm having to use an extra addForce(...) in order to get my character to not float slowly to the ground like a balloon that's running out of helium AND setLinearVelocity(...) is negating this if I'm moving forward/backward.

2. But if I use a kinematic actor there aren't any collisions and it doesn't respond to force right?

3. CreateBody templating is what I was referring to (which is coming soon as I stated). Is there another way to inherit the actor in multiple classes along with renderable information with distinct collision callbacks that I've missed?


I'm not trying to argue or whine. I WANT to use NxOgre. I like the way it's structured and interfaces with the rest of my project. I'm just having huge frustrations in dealing with my character.

EDIT: To try it out I set my character to Kinematic...setLinearVelocity and setAngularVelocity no longer worked, character appeared inside the floor of my cave and wouldn't move.

betajaen

01-10-2008 16:30:11

1. It should be if your using the right value for gravity (~ -9.8).

2. No. You would have to use the sweep API and raycasting to detect collisions yourself, this is basically what the NxCharacter is.

3. Yes. It's all there now, the template idea is literally a list of factories in a map assigned to a number. There is no reason why you can borrow the OgreSceneRenderer code yourself and adjust it to create what ever Body you want to. It's just a simple switch statement.

mcaden

01-10-2008 17:44:49

1. I had it as "gravity: yes" and was taking the default. I manually set it to -9 and took out my extra addForce function and it didn't do anything...I floated down so slowly I could've gone and grabbed a cup of coffee and still wouldn't be touching the ground. I searched on the internet for physx and gravity and read in a forum that gravity was 98 newtons...I changed gravity to -98, set mLinearDamping to 0...and voila...FINALLY I have working gravity. And with gravity at that I don't slide around like I'm on ice.

2. Yuck...ahh well, if that's the best way to do it that's how I'll need to do it.

3. You have the templating finished? Gonna update [unstable]?

betajaen

01-10-2008 17:51:48

3. No I'm still working on the map code. I was describing what it will be in total. Just a look up from a map to a factory, it's really easy to implement.

mcaden

01-10-2008 18:10:48

I actually just realized that since I fixed gravity...most of my issues are solved if I simply don't allow the character's movement to be controlled in the middle of a jump (which makes perfect sense anyway).

I might try to implement something similar to http://www.ogre3d.org/wiki/index.php/Og ... _Character as I posted above to solve the orientation issue - I have to learn how to use capsules though. After that my only issue is jumping off of objects.