![Laughing :lol:](./images/smilies/icon_lol.gif)
![Laughing :lol:](./images/smilies/icon_lol.gif)
Code: Select all
Debug.Assert(characterBody.Awake, "Velocity changes don't automatically update objects; the character should have already been woken up before applying air control.");
Code: Select all
Console.WriteLine(pair.A.Handle);
Console.WriteLine(pair.B.Handle);
Support means the character is standing on something. That assert is meant to protect against modifications to the velocity when the character is asleep, since directly modifying velocities does not automatically wake bodies up. In the original version of that function, there's a section before the air control block that ensures the character is awake if anything relevant about the control state has changed.It think it is because support is false. But what is bool support mean?
Printing zero may be correct- handles can be zero, and it's possible that a body with a handle of 0 is colliding with a static with a handle of 0. Bodies and statics can have overlapping handle values since they refer to different systems (similar to how constraint handles can overlap body or static handles).But it show 0 is it working correctly. And also when add to simulation I tried to print handle but it show nothing
Code: Select all
var characterShape = character.Shape();
characterShape.ComputeInertia(1, out var characterInertia);
characterInertia.InverseInertiaTensor = default;
int handle = Simulation.Bodies.Add(BodyDescription.CreateDynamic(character.GetStartPosition(), characterInertia, new CollidableDescription(Simulation.Shapes.Add(characterShape), 0.1f), new BodyActivityDescription(0.01f)));
Hmm alright—that doesn't exactly sound trivial to implement, so I think I'll try to find a different solution...although I find it strange that something like this isn't built-in to Unity (there's questions about it all over Google
It targets a velocity relative to the support. This does require knowing the velocity of the support at the support point. In terms of the velocity constraint formulation, it's very similar to a friction constraint, except targeting arbitrary velocities rather than just zero.So what I'm wondering now is how Bepu's character controller avoids overriding the velocity from its support.
Code: Select all
dot(worldVelocityOfSupportPointOnCharacter - worldVelocityOfSupportPointOnSupport, movementBasisX) = targetVelocityAlongBasisX
dot(worldVelocityOfSupportPointOnCharacter - worldVelocityOfSupportPointOnSupport, movementBasisY) = targetVelocityAlongBasisY
Code: Select all
worldVelocityOfSupportPointOn______ = bodyAngularVelocity x (supportPoint - bodyCenter) + bodyLinearVelocity