|
Post by chainsawpenguin on Feb 9, 2017 20:25:34 GMT
UPDATE: I'm a moron.
He was standing on a much steeper slope than I thought. The texture was creating an optical illusion that he was standing on a flat-ish surface.
Feel free to mock and throw things.
-----
Good afternoon, team! I've tried searching around to no avail, so I decided to just ask. My character is slowly sliding (downhill) when he's on a gentle (<45 degrees) slope. Unless I make the ground perfectly flat, he's sliding. What can I do to have him stand still when on a slope like this? Do I need to increase his friction somewhere?
Thanks!
~~ chainsawpenguin ~~
|
|
|
Post by Legion on Feb 9, 2017 21:09:03 GMT
Have you tried with Physic Materials in your character's capsule collider?
Make one and try this values: Dynamic Friction 0.4 Static Friction 0.4 Bounciness 0 Friction Combine Average Bounce Combine Minimum
|
|
|
Post by shadex on Feb 13, 2017 21:47:39 GMT
UPDATE: I'm a moron. He was standing on a much steeper slope than I thought. The texture was creating an optical illusion that he was standing on a flat-ish surface. Feel free to mock and throw things. ----- Good afternoon, team! I've tried searching around to no avail, so I decided to just ask. My character is slowly sliding (downhill) when he's on a gentle (<45 degrees) slope. Unless I make the ground perfectly flat, he's sliding. What can I do to have him stand still when on a slope like this? Do I need to increase his friction somewhere? Thanks! ~~ chainsawpenguin ~~ We all have those lol. I've found nothing in this world that makes me feel as smart or as stupid as game design.
|
|
|
Post by Invector on Feb 14, 2017 17:02:10 GMT
I saw this the other day and just create another physics material
// slides the character through walls and edges frictionPhysics = new PhysicMaterial(); frictionPhysics.name = "frictionPhysics"; frictionPhysics.staticFriction = .25f; frictionPhysics.dynamicFriction = .25f; frictionPhysics.frictionCombine = PhysicMaterialCombine.Multiply;
// prevents the collider from slipping on ramps maxFrictionPhysics = new PhysicMaterial(); maxFrictionPhysics.name = "maxFrictionPhysics"; maxFrictionPhysics.staticFriction = 1f; maxFrictionPhysics.dynamicFriction = 1f; maxFrictionPhysics.frictionCombine = PhysicMaterialCombine.Maximum;
// air physics slippyPhysics = new PhysicMaterial(); slippyPhysics.name = "slippyPhysics"; slippyPhysics.staticFriction = 0f; slippyPhysics.dynamicFriction = 0f; slippyPhysics.frictionCombine = PhysicMaterialCombine.Minimum; And on the CheckGround method, did this verification:
if(isGrounded && input == Vector2.zero) _capsuleCollider.material = maxFrictionPhysics; else if(isGrounded && input != Vector2.zero) _capsuleCollider.material = frictionPhysics; else _capsuleCollider.material = slippyPhysics;
|
|
|
Post by chainsawpenguin on Feb 17, 2017 3:11:11 GMT
Awesome! Thanks!
|
|