I hope it's okay I contact you in this direct fashion with a bunch of
questions about your RayCar demo. I hope you have the time to help me
out, because I have quite a lot of questions (for which I apologize in
advance ^_^)... If you prefer to do this on the ODE ML, please let me
know. If you have no time, please let me know too :)
Okay, I'm mostly interested in your work on the FPS character. If I
understand your code (and what I've read about it on the web) correctly,
you have a single capsule for the player character, and push it around
based on a raycast, right? Could you explain why you use the raycasts in
the first place? Where is it for? Why not just push the capsule around
based on the player input? And is the capsule hovering over the ground
in the air, or is it actually on the ground? I can't seem to find out.
And could you explain roughly what the general idea of your setup is?
Let me explain: you seem to have multiple spaces. Why is this? Why not
just push everything in one big space?
And last but not least, I'm kinda baffled by a specific part of the
ObjPlayer::step function: the part with the header "// calculate
rightening forces, even if not floor contacted". What exactly are you
doing there? What are these 'rightening' forces, and what would happen
if you don't include them?
One final note: you have a 3rd person view, I'm trying to build a 1st
person view. If you do any specific 3rd person stuff that I can ignore
for my case, I would love to learn about it.
Again, sorry for all the questions. I'm trying to integrate ODE into my
engine as best as I can. I will give you full credit for all your help!
First, yes, the character is a "lollipop" -- a capsule suspended on a "leg" made by a ray. That model is pretty good, because it allows you to easily climb stairs, which is much harder to get right when only using a capsule, because you'll need a large radius to be able to climb stuff, but the capsule also needs to be narrow to only frame the torso of the character. The "character" (the cylinder with the block at the bottom) shows the approximate dimensions of the capsule and the ray.
The "righting" forces are there to keep the character upright, and pointing in the direction you indicate. If they weren't there, if you happened to walk into something head-height, you'd fall over, and have no way to rise up again. Using forces, rather than smashing the orientation directly, is there to give proper physical response.
As for first-person perspective, you can do that just fine by just moving the camera. However, the controls for a first-person game typically are tuned differently than a third person game, so make sure you compensate for that. In fact, if you want a fast-paced game like Unreal Tournament, then you don't want just debris on the ground at all, because up/down movement doesn't work well together with first person gameplay. That's a level, control and game design question, though, more than a technology question.
Jon, thanks for your answers! A few follow up questions though ^_^
First off, are you saying I wouldn't need the rightening forces when I just set the maximum angular velocity to 0?
Furthermore, how exactly does the capsule "suspend on a leg" (maybe I'm missing something obvious here (not a native english speaker)?) In your code you cast a ray downwards, and see if it hits something closer by than the end of the feet ( if(f < legLength) ), and if it does you set some sort of force to something !=0, which you use later on. I'm not sure how this exactly controls the capsule geom. Can you elaborate a little on this?
Even if you set rotational velocity to 0, the body will accumulate rotation through constraint solutions, so you'll have to figure out some way of keeping it upright. The brute force solution is to re-calculate the orientation and change it each step, but that's bad for a variety of reasons (including generating possible penetrations).
The force is added to the center of the capsule, to keep it suspended above the ground. It's basically a simulation of a dampened spring, with some additional logic (don't let the legs "suck you down" towards the ground when you're bouncing up, for example).
General concepts behind RayCar FPS movement
Hey Jon,
I hope it's okay I contact you in this direct fashion with a bunch of
questions about your RayCar demo. I hope you have the time to help me
out, because I have quite a lot of questions (for which I apologize in
advance ^_^)... If you prefer to do this on the ODE ML, please let me
know. If you have no time, please let me know too :)
Okay, I'm mostly interested in your work on the FPS character. If I
understand your code (and what I've read about it on the web) correctly,
you have a single capsule for the player character, and push it around
based on a raycast, right? Could you explain why you use the raycasts in
the first place? Where is it for? Why not just push the capsule around
based on the player input? And is the capsule hovering over the ground
in the air, or is it actually on the ground? I can't seem to find out.
And could you explain roughly what the general idea of your setup is?
Let me explain: you seem to have multiple spaces. Why is this? Why not
just push everything in one big space?
And last but not least, I'm kinda baffled by a specific part of the
ObjPlayer::step function: the part with the header "// calculate
rightening forces, even if not floor contacted". What exactly are you
doing there? What are these 'rightening' forces, and what would happen
if you don't include them?
One final note: you have a 3rd person view, I'm trying to build a 1st
person view. If you do any specific 3rd person stuff that I can ignore
for my case, I would love to learn about it.
Again, sorry for all the questions. I'm trying to integrate ODE into my
engine as best as I can. I will give you full credit for all your help!
Kind regards,
Marc 'Foddex' Oude Kotte
http://www.foddex.net
Lots of questions! First,
Lots of questions!
First, yes, the character is a "lollipop" -- a capsule suspended on a "leg" made by a ray. That model is pretty good, because it allows you to easily climb stairs, which is much harder to get right when only using a capsule, because you'll need a large radius to be able to climb stuff, but the capsule also needs to be narrow to only frame the torso of the character. The "character" (the cylinder with the block at the bottom) shows the approximate dimensions of the capsule and the ray.
The "righting" forces are there to keep the character upright, and pointing in the direction you indicate. If they weren't there, if you happened to walk into something head-height, you'd fall over, and have no way to rise up again. Using forces, rather than smashing the orientation directly, is there to give proper physical response.
As for first-person perspective, you can do that just fine by just moving the camera. However, the controls for a first-person game typically are tuned differently than a third person game, so make sure you compensate for that. In fact, if you want a fast-paced game like Unreal Tournament, then you don't want just debris on the ground at all, because up/down movement doesn't work well together with first person gameplay. That's a level, control and game design question, though, more than a technology question.
Jon, thanks for your answers!
Jon, thanks for your answers! A few follow up questions though ^_^
First off, are you saying I wouldn't need the rightening forces when I just set the maximum angular velocity to 0?
Furthermore, how exactly does the capsule "suspend on a leg" (maybe I'm missing something obvious here (not a native english speaker)?) In your code you cast a ray downwards, and see if it hits something closer by than the end of the feet ( if(f < legLength) ), and if it does you set some sort of force to something !=0, which you use later on. I'm not sure how this exactly controls the capsule geom. Can you elaborate a little on this?
Even if you set rotational
Even if you set rotational velocity to 0, the body will accumulate rotation through constraint solutions, so you'll have to figure out some way of keeping it upright. The brute force solution is to re-calculate the orientation and change it each step, but that's bad for a variety of reasons (including generating possible penetrations).
The force is added to the center of the capsule, to keep it suspended above the ground. It's basically a simulation of a dampened spring, with some additional logic (don't let the legs "suck you down" towards the ground when you're bouncing up, for example).