| View previous topic :: View next topic |
| Author |
Message |
Mark Tanner
Joined: 24 Feb 2005 Posts: 5 Location: USA
|
Posted: Sun Apr 17, 2005 5:26 pm Post subject: Using a capsule for player collisions. |
|
|
This is in a way a follow-up to a previous post about using a capsule for player collisions.
I implemented this; capsule debug renders ok.
What I don't understand is this: if SetPosition doesn't generate collisions (as explained in the help file), how can you use this for collisions/pushing other dynamic objects? Suppose one frame the player is away from a dynamic object and the next you position the capsule close to it, this doesn't generate a collision, so it has no effect.
I mean, you cannot reliably use impulses to move a player capsule accurately, you almost have to use SetPosition.
Since the help file mentions using rotation-disabled objects for player collisions, what should be the procedure for this? Is there any more info?
I guess most people want to use a capsule to do collision detection instead of writing their own, since TrueAxis already has this capability.
Thanks! |
|
| Back to top |
|
 |
kurtz
Joined: 02 Apr 2005 Posts: 56
|
Posted: Sun Apr 17, 2005 6:43 pm Post subject: |
|
|
| You could try using the intermediate function (between applying and impulse and setting the position) which would be to set the velocity appropriately. This will produce collisions and should provide adequate control over the player. |
|
| Back to top |
|
 |
Ultrasauce
Joined: 28 Feb 2005 Posts: 62
|
Posted: Sun Apr 17, 2005 9:25 pm Post subject: |
|
|
It should be reasonable to use forces (Rather than just impulses). That's much better than SetPosition or SetVelocity, because you could implement, for example, ice... where the player slides around. Or a hill, where the player can't walk as fast up as they can down.
You could use a capsule with a couple of rays casted down (like legs). And use those to apply spring-like forces (jumping, crouching)... Also easily deal with things like stairs. You'd have full control over forces on the ground to make the control as realistic as you want. The only bummer with a ray is if you want to do something like a conveyor belt or escalator... in those cases, since there's no real collision, you'd have to detect that.
But I know people, using various physics engines, are able to get good character control using a capsule, forces, and an up-joint of some sort. It's always best to stick with forces. At least you know you won't throw off the simulation's realism or worse, stability. |
|
| Back to top |
|
 |
luke Site Admin
Joined: 15 Oct 2004 Posts: 621
|
Posted: Mon Apr 18, 2005 3:29 am Post subject: |
|
|
Using DynamicObject::SetPosition for moving objects that you want to interact properly with the simulation will not work well. You should use ApplyImpulse or SetVelocity.
The engine is impulsed based internally and doesn't see much difference between impulses and forces. Forces are converted to inpuleses with the formula impulse = force * franeTime.
You can use ApplyImpulse which has some nice advantages as Ultrasouce mentioned like sliping on ice but I prefere to use SetVelocity because it gives me more precise control but still interacts fine when pusing objects (At least in this Physics SDK).
You can disable rotation with the TA::DynamicObject::SetRotationDisabled function.
There is also source code posted for this type of thing in the "Any suggestions for using physics to move a human?" thread in the general discusion forum. |
|
| Back to top |
|
 |
|