Starting from the begining again

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Starting from the begining again

Post by nikolaiko »

Hi.

I worked with BEPUPhysics for a while and already build some world for future game, but looks like I made a mistake at the very begining of the developing, so, I need to left the world in current state and get back to change somethings in base objects. But to do everything right in second try I just want to clear something before starting. We have a robot models :

Image

1. In my world I need to simulate moving of this robots, I wan't bodies in physical be same form as robot, so players will be able to shot between legs, for example. This models have animation, so it will be good, but not very imprtend if bodies in physics world will dublicate animations of robots.

2. I need to have as much physics on those bodies as it can have. Friction, Bounce and all others. I used CharacterController, but it ignores friction, for example (and I guess have some other options, because it was created for current purposes).

How I can do this and what objects, controllers or entity types I need?

Thanks.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Starting from the begining again

Post by Norbo »

1. In my world I need to simulate moving of this robots, I wan't bodies in physical be same form as robot, so players will be able to shot between legs, for example. This models have animation, so it will be good, but not very imprtend if bodies in physics world will dublicate animations of robots.
Create entities for the segments of the robot body. Position and orient them according to graphical transforms. (If you expect collision response to work well, you'll also want to compute velocities for them based on their movement since previous frames.) Set up collision rules such that projectiles and other relevant objects detect collision with these segments instead of the CharacterController body.

The physical segments can just be kinematic entities. Other objects won't be able to push them around. The CharacterController body will act as the environmental collision proxy allowing it to smoothly navigate without getting its tiny pieces stuck on geometry.

If you want the ability for projectiles to shove the character around, there are a few main options.
1) Fake it. When a collision is detected, decide if it's a hard enough hit; if it is, apply an impulse to the character based on the proxy-detected contacts. This is the simplest and fastest option.
2) Make the proxies dynamic and connect the proxies to the character using constraints so that an impact naturally applies impulses to the character body.
3) Make the CharacterController's body a compound, with the segments as children. The collision rules mentioned earlier still apply. In this approach, there is only one actual entity, but with multiple simultaneous colliders, so impacts will naturally shove the object. This approach would require some modifications to the character controller.

If you want fully physical behavior on impact (an arm being bent by the force an incoming attack, for example), you'll need to create dynamic objects for the whole body and bind them together using reasonable physical constraints. The result should be something like a motorized ragdoll. Such a ragdoll will struggle to move in the exact same way as an animation, since it is limited by physics. Further, the motorized ragdoll will be incapable of balancing in almost every case, so you'll have to include logic to keep it upright and all sorts of other stuff. I would only recommend going this route if your entire game is about slightly silly physics-based combat, like Gang Beasts or... that one indie FPS in development that I cannot remember the name of.
I need to have as much physics on those bodies as it can have. Friction, Bounce and all others. I used CharacterController, but it ignores friction, for example (and I guess have some other options, because it was created for current purposes).
If the character's movement is supposed to behave like the CharacterController, I would strongly recommend using the CharacterController despite the fact that it ignores things like friction. You can change the speed and force to emulate the effect of friction.

If you do not use the CharacterController, you will have to reimplement all movement logic. Doing this robustly is not trivial.
nikolaiko
Posts: 43
Joined: Mon Aug 04, 2014 8:26 am

Re: Starting from the begining again

Post by nikolaiko »

Hey, Thanks a lot! Usefull info, I don't think that I need ragdoll physics, so to entities for the segments of the robot body.
Post Reply