
Charachter controller
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
I solve the charachter wide stpes , Norbo thaaaaaaaaank you , I will next try to import animated skinned charachter and see what happens
, so I will post questions later .

-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Hello again Norbo
, I done the lesson on joints and constrains , but the question is how to do ragdoll for FBX skinned model .For example , how to do rag doll for microsoft skinned sample or what is your advice my teacher Norbo ?

Last edited by mohammadAdnan on Sun Mar 10, 2013 11:31 pm, edited 1 time in total.
Re: Charachter controller
The physics side of things is shown by the Ragdoll Demo downloadable from the Joints and Constraints documentation page. To apply that to graphics requires creating a mapping from physics 'bones' (entities) to graphical bones. This mapping is a bunch of transforms telling you where to put graphics bones relative to physics bones. A related in-depth discussion can be found here: viewtopic.php?f=4&t=1854
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Norbo thank you so much teacher 

-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Norbo , for my skinned animated Model ,I copied from the "ragdoll demo" just one class "Ragdoll.cs ", as other classes are in my game project such as "Camera " ,i did not also copy the "DisplayGrabSpring.cs , GrabSpring.cs " as they made for grab the ragdoll around the space in the "ragdoll demo" , which is not needed for my game !!.
So , my question according to what I explained , Right now I have to only follow the link you gave to me before " viewtopic.php?f=4&t=1854 " , and made an entity at each bone in the skinned Model or just use the rag doll demo entities . the ragdoll entities made for ragdoll , i think I have to not render them right , but instead just add them to the space and make them transforms with my skinned model to make it colliodable !!
Sorry Norbo for the English !!
So , my question according to what I explained , Right now I have to only follow the link you gave to me before " viewtopic.php?f=4&t=1854 " , and made an entity at each bone in the skinned Model or just use the rag doll demo entities . the ragdoll entities made for ragdoll , i think I have to not render them right , but instead just add them to the space and make them transforms with my skinned model to make it colliodable !!
Sorry Norbo for the English !!
Re: Charachter controller
Correct- you do not need to render the physical entities directly if you have another mesh representing them. The physics and graphics are totally separate, so you can represent physics however you want graphically.i think I have to not render them right , but instead just add them to the space and make them transforms with my skinned model to make it colliodable !!
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Norbo , when I scale the ragdoll (entities) they behave strangely and don not scaled when myltiplied by scaling matrix !. when I copy the ragdoll demo inside my project , the ragdolls are very small relative to my skinned Model and here is the code :
First Norbo, I don't know if the reason is because I did not copy the other classes from ragdoll into my project which are : GrabSpring.cs , DisplayGrabSpring.cs , Camera.cs(this one already exists in my project). what you say Norbo ?
The second question ,the ragDoll entities collapsed down to the ground when run my project , dose the solution to this to multiply the entities with the skinned model pind pose transforms so they not collapsed and follow the skinned Model animation matrices ?
Code: Select all
//Intialize Player RagDoll
#region Simulation code
//Create ragdolls and other stuff in the world.
Random random = new Random();
int numRows = 4;
int numColumns = 2;
float xSpacing = 5;
float zSpacing = 5;
for (int i = 0; i < numRows; i++)
{
for (int j = 0; j < numColumns; j++)
{
Ragdoll ragdoll = new Ragdoll(space,
Matrix.CreateFromYawPitchRoll( //Uncomment this transformation to randomly rotate the ragdolls.
(float)random.NextDouble() * MathHelper.TwoPi,
(float)random.NextDouble() * MathHelper.TwoPi,
(float)random.NextDouble() * MathHelper.TwoPi) *
Matrix.CreateScale(15)
*
Matrix.CreateTranslation(new Vector3(
i * xSpacing - numRows * xSpacing / 2, -3.5f,
j * zSpacing - numColumns * zSpacing / 2))
);
}
}
#endregion
First Norbo, I don't know if the reason is because I did not copy the other classes from ragdoll into my project which are : GrabSpring.cs , DisplayGrabSpring.cs , Camera.cs(this one already exists in my project). what you say Norbo ?
The second question ,the ragDoll entities collapsed down to the ground when run my project , dose the solution to this to multiply the entities with the skinned model pind pose transforms so they not collapsed and follow the skinned Model animation matrices ?
Re: Charachter controller
That ragdoll only supports rigid transforms, meaning translations and rotations. This is because the entity.WorldTransform can only accept rigid transforms. If you want to make a ragdoll of different sizes, you'll need to modify the ragdoll to take a scaling parameter and construct all the constituent entities according to the scale and so on.Norbo , when I scale the ragdoll (entities) they behave strangely and don not scaled when myltiplied by scaling matrix !
Those classes are unrelated.First Norbo, I don't know if the reason is because I did not copy the other classes from ragdoll into my project which are : GrabSpring.cs , DisplayGrabSpring.cs , Camera.cs(this one already exists in my project). what you say Norbo ?
Usually, if the model is controlled by animation completely, the ragdoll isn't being simulated at all and isn't in the space. Ragdolls are simulated once the character 'dies' and animation is no longer in use. While the character is 'alive', the CharacterController's cylindrical body acts as the collision shape anyway, so having the ragdoll present is redundant.The second question ,the ragDoll entities collapsed down to the ground when run my project , dose the solution to this to multiply the entities with the skinned model pind pose transforms so they not collapsed and follow the skinned Model animation matrices ?
If you do want the ragdoll to follow the animation for some reason, then yes, you would need to position the entities using transformations derived from the animation.
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Norbo , thank you again .
Norbo I starts this post to do character controller -Done- and making an animation for my models under BEPUPhysics engine -Not done yet- , Norbo all I need is making my 3d model which is Skinned Model with one animation clip move and I don't know how this is done ! as I hear a lot about RagDoll , Inverse kinematics .....etc , and I don't know much about them as I am Computer graphics student not specialized in animation ! , I hope Norbo to give me some steps about how to making my skinned model ( Microsoft skinned sample animated model) animate .
Q : How to make ( Microsoft skinned sample animated model ) move ? what are the techniques used for that ? is there any code in BEPU forms helping developers doing that ? Rag Doll used to simulate character when he dies , so what is the technique used to making my model move based on animation clip inside my model ??
sorry for the language Norbo.
Norbo I starts this post to do character controller -Done- and making an animation for my models under BEPUPhysics engine -Not done yet- , Norbo all I need is making my 3d model which is Skinned Model with one animation clip move and I don't know how this is done ! as I hear a lot about RagDoll , Inverse kinematics .....etc , and I don't know much about them as I am Computer graphics student not specialized in animation ! , I hope Norbo to give me some steps about how to making my skinned model ( Microsoft skinned sample animated model) animate .
Q : How to make ( Microsoft skinned sample animated model ) move ? what are the techniques used for that ? is there any code in BEPU forms helping developers doing that ? Rag Doll used to simulate character when he dies , so what is the technique used to making my model move based on animation clip inside my model ??
sorry for the language Norbo.
Re: Charachter controller
Fundamentally, to animate something:Q : How to make ( Microsoft skinned sample animated model ) move ? what are the techniques used for that ? is there any code in BEPU forms helping developers doing that ? Rag Doll used to simulate character when he dies , so what is the technique used to making my model move based on animation clip inside my model ??
A) Vertices are associated with bones (weight mapping),
B) Bones are transformed according to some process,
C) Vertices are transformed using the bone transforms resulting from that process.
That process which move bones around can be anything. For example:
1) A ragdoll can be used in such a process to find out where bones should be based on the physical simulation.
2) Loading frames from an animation made in some animation program to scoot the bones to the desired place.
3) Inverse kinematics which seeks to reach a goal state by modifying the transforms.
4) Arbitrary procedural animation.
5) A combination of any of the above.
BEPUphysics can perform the underlying simulation for #1 and #3, but because BEPUphysics is completely unaware of graphics, it will not help apply the results to the model at all. If you need more information about how to actually apply animations, then you should check out some graphics oriented samples. The Skinned Model sample you've already found goes through A, B, C and #2 above in depth.
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Ok Norbo , If I follow process #2 then : (Norbo the following steps may not be true , so pls say your opinion about them )Norbo wrote:Fundamentally, to animate something:Q : How to make ( Microsoft skinned sample animated model ) move ? what are the techniques used for that ? is there any code in BEPU forms helping developers doing that ? Rag Doll used to simulate character when he dies , so what is the technique used to making my model move based on animation clip inside my model ??
A) Vertices are associated with bones (weight mapping),
B) Bones are transformed according to some process,
C) Vertices are transformed using the bone transforms resulting from that process.
That process which move bones around can be anything. For example:
2) Loading frames from an animation made in some animation program to scoot the bones to the desired place.
The Skinned Model sample you've already found goes through A, B, C and #2 above in depth.
1 : All I have to do is load animation and multiply the worldTransofrm(which is from FBX file) for each bone in the model with the chrachterController.WolrdTransform to make the model move when the charachter Controller move ?? (I think this is right ! ) .
2 : To add physics to my skinned model , I just add convex hull around my skinned model and add it to space.
3 : To rotate the player hand and the gun , I just multiply the hand by the chachterController orientation matrix (Right Norbo) , and making the Gun follow the transform.
Re: Charachter controller
The CharacterController.Body.Position should be used to translate your graphic. The CharacterController.Body does not rotate, however: its inertia tensor is infinite to prevent it from falling over. The camera facing direction or some other supplementary information should be used to inform the rotation component.1 : All I have to do is load animation and multiply the worldTransofrm(which is from FBX file) for each bone in the model with the chrachterController.WolrdTransform to make the model move when the charachter Controller move ?? (I think this is right ! ) .
If you've already created a CharacterController, the character already has a physical representation. It's the CharacterController.Body. Creating a convex hull around the skinned model would be redundant and unhelpful.2 : To add physics to my skinned model , I just add convex hull around my skinned model and add it to space.
Since the CharacterController.Body does not rotate, the you'll need to use the camera view as before for rotation purposes.3 : To rotate the player hand and the gun , I just multiply the hand by the chachterController orientation matrix (Right Norbo) , and making the Gun follow the transform.
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
thanks Norbo , I was waiting for the next question and I am still in the character animation stage .
Norbo , I have code for FPS shooter game camera , but it's a little bit annoying ! , so all i need is the rotation matrix for the player hands to be rotated with the camera ( I know it's graphics stuff) , but the the one that is related to BEPU is that I tries to get the rotation matrix from the following to rotate hands and gun and never works :
1 : rotatePlayerhands = Matrix.CreateFromQuaternion(cci.CharacterController.Body.Orientation); ( not rotating the model hands with the camera ).
2 : rotatePlayerhands = Matrix.Invert( Matrix.CreateFromYawPitchRoll(cci.Camera.Yaw,cci.Camera.Pitch,0 ) ); ( not rotating the model hands with the camera ).
3 : rotatePlayerhands=
Matrix.CreateRotationX(this.Body.AngularVelocity.X) *
Matrix.CreateRotationY(this.Body.AngularVelocity.Y) *
Matrix.CreateRotationZ(this.Body.AngularVelocity.Z); // ( not rotating the model hands with the camera )
so I try to just use BEPU rotation matrices for body and camera respectively and nothing works
Norbo , I have code for FPS shooter game camera , but it's a little bit annoying ! , so all i need is the rotation matrix for the player hands to be rotated with the camera ( I know it's graphics stuff) , but the the one that is related to BEPU is that I tries to get the rotation matrix from the following to rotate hands and gun and never works :
1 : rotatePlayerhands = Matrix.CreateFromQuaternion(cci.CharacterController.Body.Orientation); ( not rotating the model hands with the camera ).
2 : rotatePlayerhands = Matrix.Invert( Matrix.CreateFromYawPitchRoll(cci.Camera.Yaw,cci.Camera.Pitch,0 ) ); ( not rotating the model hands with the camera ).
3 : rotatePlayerhands=
Matrix.CreateRotationX(this.Body.AngularVelocity.X) *
Matrix.CreateRotationY(this.Body.AngularVelocity.Y) *
Matrix.CreateRotationZ(this.Body.AngularVelocity.Z); // ( not rotating the model hands with the camera )
so I try to just use BEPU rotation matrices for body and camera respectively and nothing works
Code: Select all
// Update Player
Vector3 forward = cci.Camera.WorldMatrix.Forward * new Vector3(5);
Matrix translatePlayer = Matrix.CreateTranslation(cci.Camera.WorldMatrix.Translation +
forward + new Vector3(0,-4,0));
Matrix scalePlayer = Matrix.CreateScale(0.05f);
Matrix rotatePlayer =Matrix.Invert( Matrix.CreateFromYawPitchRoll(cci.Camera.Yaw,cci.Camera.Pitch,0 ) );
staticModel.Transform = scalePlayer * rotatePlayer * translatePlayer;
//staticModel.Transform = WeaponWorldMatrix(cci.Camera.Position, 0, 1);
Re: Charachter controller
Option 1 does not work because the character controller body does not rotate. Option 2 does not work (at least partially) because of the matrix inversion; it should not be inverted. Option 3 does not work because it creates a partial rotation based on the current velocity, not an orientation.
-
- Posts: 48
- Joined: Sat Jan 26, 2013 5:54 pm
Re: Charachter controller
Norbo , how to get a proper rotation matrix for the model rotation ( Rotate Player hands with the Camera ) ?