About Store Forum Documentation Contact
Donations:
227$/mo



Post Reply 
Wall collision
Author Message
ID0 Offline
Member

Post: #1
Wall collision
I want the player will slide along the wall, like in all FPS, but he stuck, even with such a tilt relative to the wall (I press forward here). Also he stuck in all of the doors, corners etc. It's annoying, is there any way to fix this?

[Image: image_4e008871ceea2.jpg]
(This post was last modified: 06-21-2011 12:54 PM by ID0.)
06-21-2011 12:53 PM
Find all posts by this user Quote this message in a reply
Dandruff Offline
Member

Post: #2
RE: Wall collision
try checking the phys boxes of the walls, if they're properly aligned with the mesh
06-21-2011 06:56 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #3
RE: Wall collision
You can visualize the physics like so:

Code:
void Draw()
{
    Renderer(Render);
    if (Renderer.rebuildDepthNeededForDebugDrawing()) Renderer.rebuildDepth();

    if (Kb.b(KB_V)) Physics.draw();
}

At anytime during the game, just press V to draw the physics.

The player is likely getting stuck when running into the wall instead of sliding due to friction. You can edit friction values (or disable altogether) like so:

Code:
Physics.create(CSS_NONE, true, "../../../EsenthelEngineSDK/Installation/PhysX");
Physics.material[PHYS_MTRL_CHR].anisotropic(false);
Physics.material[PHYS_MTRL_CHR].frictionDynamic(0);
Physics.material[PHYS_MTRL_CHR].frictionMode(PhysMtrl::MODE_MIN);
Physics.material[PHYS_MTRL_CHR].frictionStatic(0);

The above code disables friction on the player so you will slide off everything (also slides on flat ground a bit, if at high speeds). You may not want to disable it completely, just tweak the values to your liking.

If the player is getting stuck when going through doors, the doors may be too small for the capsule around the player to fit through. You could either make the doors wider/taller, or make the capsule around the player smaller. You can change that like so:

Code:
void Player::create(Game::ObjParams &obj)
{
    __super::create(obj);
    ctrl.radius(0.4f); // default is 0.45f
}
06-21-2011 08:02 PM
Find all posts by this user Quote this message in a reply
ID0 Offline
Member

Post: #4
RE: Wall collision
Thank you very much!
06-21-2011 08:13 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #5
RE: Wall collision
No problem smile
06-21-2011 08:23 PM
Find all posts by this user Quote this message in a reply
Post Reply