Characther models and some other questions

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Menyueru
Posts: 17
Joined: Sun Jun 09, 2013 11:28 pm

Characther models and some other questions

Post by Menyueru »

First of, i don't have much experience with 3d games and this is my first one right now, I'm working on a 3rd Person shooter as my final college project using xna, and well bepu. First of I'm not sure how to use Bepu with an humanoid model, i was thinking of using a sphere for the head and different boxes for the rest of the body and just keep them together with some joints, What do you guys think or should i try another approach? if so please elaborate.

Also because it's a 3rd person shooter I need the projectiles to shoot from the character to a point towards the center of the screen, i know i have to create the projectile with a linearvelocity, but I'm not sure how to calculate this so that it goes the right direction, i want it to go straight through the center of the screen but the character is a bit to the left of it.

Also i was trying with the getting started map playground the engine in itself, and shooting some projectiles, and i noticed that when it got too fast it just crossed the map without any colision, and in one part the projectiles got stuck in the house at the center of the map, how can i stop them from not collisioning?

Thanks in advance, :)
kavatortank
Posts: 91
Joined: Tue May 14, 2013 12:17 pm

Re: Characther models and some other questions

Post by kavatortank »

I do not know if I'm allowed to answer you, but I try.

For the first part, ie that:
First of, i do not have much experience with 3d games and this is my first one right now, I'm working on a 3rd Person shooter as my final college project using xna, and well BEPU. First of I'm not sure how to use BEPU with humanoid model year, i was thinking of using a sphere for the head and different boxes for the rest of the body and just keep 'em together with some seals, What do you guys think or should i try Reviews another approach? if so please elaborate.
I would not answer it, because I do not think I have the knowledge.

To do this:
Also Because it's a 3rd person shooter I need to shoot the projectiles from the character to a Point: towards the center of the screen, i know i have to create the shot with a linearvelocity, but I'm not sure how to calculate this so That it goes the right direction i want it to go straight through the center of the screen character is the aim a bit to the left of it.
Simply just like the demo BEPU in standarsDemo I think, change the linear velocity of the missile based on the matrix of it.
Example:

Code: Select all

Vector3 impulse Game.Camera.WorldMatrix.Forward * = 5000;
kapow.ApplyLinearImpulse (ref impulse);
As you can see, the projectile will pull the front of the camera, then apply a factor to increase the speed.

It comes to:
Trying Also i was getting started with the engine in the playground map Itself, and shoot some shots, and i Noticed That When It got too fast it just crossed the map without any colision, in one hand and the shots got stuck in the house at the center of the map, how can i not stop 'em from collisioning?
The speed of your shot is too high. The discrete collisions not enough, we must use the continuous collisions

Example:

Code: Select all

                    kapow.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;

PS : Sorry for my english :)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Characther models and some other questions

Post by Norbo »

Menyueru wrote:First of I'm not sure how to use Bepu with an humanoid model, i was thinking of using a sphere for the head and different boxes for the rest of the body and just keep them together with some joints, What do you guys think or should i try another approach? if so please elaborate.
If you're thinking about how to handle FPS-style character movement, generally you should just use something like the CharacterController. The shape itself is just a cylinder, but it supports running around, jumping, stepping, and the rest.

If you're asking about how to handle a ragdoll, then yes, a combination of entities connected by joints would be what you want. Examples can be found in the RagdollDemo and in the BEPUphysicsDemos source. You'll need to create a mapping from the graphical model bones to the ragdoll entities so that, when the character dies, you can position and orient the entity bones according to the current animation state. The ragdoll entities do not need to be in the simulation all the time- just when animations are not active.

If you're asking about how to handle hit detection when the character gets shot, something like the ragdoll entities could be used. However, rather than being simulated, the entities are just being teleported to exactly match the graphical animation. Further, you don't want these entities to collide with anything, since the CharacterController is presumably still active and handling environmental collisions. So, you'd disable their collision using collision rules. You can then perform ray casts or other queries to determine intersections with the shapes. Depending on the type of queries you want, these hit detection shapes don't even have to be BEPUphysicsEntities; simple bounding volumes may be sufficient.

And kavatortank covered the rest of it :)
Menyueru
Posts: 17
Joined: Sun Jun 09, 2013 11:28 pm

Re: Characther models and some other questions

Post by Menyueru »

thanks kavatortank and norbo, i think I'll try the cylinder method first for the demo of the game but later on I'll add the more complex one, and thanks for the continuous, tried it out and working perfectly.

But i think i didn't get my point straight on the second question let me try and rephrase it, I'm working on a third person shooter so I'm using a chasecam so i want the projectiles coming from the model not the camera, but i want them to go to where the center of the camera is pointing at, any of you guys have a tip of how can i do that?
kavatortank
Posts: 91
Joined: Tue May 14, 2013 12:17 pm

Re: Characther models and some other questions

Post by kavatortank »

You have to change the position

Code: Select all

 kapow.Position = box.Position + Game.Camera.WorldMatrix.Forward * 3;
Where box is your character.
But the linear impulse don"t change

Code: Select all

Vector3 impulse = Game.Camera.WorldMatrix.Forward * 500;
kapow.ApplyLinearImpulse(ref impulse);
I think that, you can also readjust the angle, like :

Code: Select all

Vector3 impulse = Vector3.Transform(Game.Camera.WorldMatrix.Forward,Matrix.CreateRotationY(MathHelper.PiOver2)) * 500;
I hope I answered your question :D
Menyueru
Posts: 17
Joined: Sun Jun 09, 2013 11:28 pm

Re: Characther models and some other questions

Post by Menyueru »

thanks for the super quick reply :D i'll tell you if it works during the week, because i'm still working on the camera ,but yeah that's more or less what i think should work, but thanks you guys sure are the best
Post Reply