Dealing with weirdly shaped character (2D)
Ok, so I've got a movement script up and running, but I get the model for the character and the head is hugely oversized. Here he is.
What I'm trying to accomplish here is movement where the collider ends at the feet, so that you can't hand off an edge very unrealistically. I also want the head to collide right with the world, for example, hitting his head on a ceiling when jumping. I tried a polygon collider, with slopes at the edges to push it out so that the head collides right, but it creates a weird drag because of the physics.
So my question is basically this; Can I get rid of the drag when using a polygon collider, or will I have to use a raycast to push the player away from the wall?
You could try setting the drag and friction of the collider to 0f, and then control the deceleration yourself. You could also do something that enables drag when the character is jumping and set it to 0f when the player touches the ground, so the movement feels natural.
Well unfortunately, I've already set Angular drag and Linear drag to 0, and the Physic$$anonymous$$at for the collider has 0 friction and 0 bounce.
I know found out that using a collider like I mentioned is not going to work. You can use the ramp on the side to shoot the character into the air without jumping. I will probably have to go the raycasting route.
What does this mean? Linear Drag affects the Rigidbody2D velocity and isn't affected by the colliders, nor does it relate to the mass of the body either. Angular Drag also affects the Rigidbody2D angular velocity and relates to the mass and it's position relative to the body. Colliders do affect the center-of-mass though but you can set that explicitly if you want. Neither linear/angular drag relate to contacts though; they are applied regardless of contacts. I see you commented on the physics-material which only comes into effect when in contact with something i.e. contact friction/bounce. $$anonymous$$aybe if you spent more time clarifying the actual problem (what is 'weird drag') then we can help you.but it creates a weird drag because of the physics
I'm sorry, I guess I wasn't that clear. It seems clear to me, but then again, I already know the problem, so...
The "drag" problem is fixed, but I'll clarify anyway. When standing on the edge, past the feet, since there was an angular collider there that pushed the player away from the edge, so that when it was falling, even though there was no friction, it didn't slide all that smoothly, certainly not as smoothly as needed. It had a kind of drag it seemed. However, using Interpolate ins$$anonymous$$d of Extrapolate helped, for some reason.