I modified the rolling ball code project to extend ACharacter instead of APawn. Now whenever the ACharacter (capsule component, now using AddMovementInput to move) runs into the boxes, which are all movable static meshes with simulate physics turned on and collision preset PhysicsActor, the colliding is incredibly twitchy. See this video: - YouTube . (Sorry for loud audio. Didn’t realize my mic was recording.) Sometimes, it will twitch so bad, the ACharacter and the box will clip into eachother and stop twitching, sometimes preventing me from moving at all. How do I get more smooth physics with my capsule collider?
Can you please post a screenshot with the “Components” section of your ACharacter blueprint? The one containing the ball. I am curious about the size of the capsule compared with the size of the ball.
I am not using a blueprint, setting up the character is all done in code. The ball is a skinned mesh, radius 100, while the capsule is 100x100.
CapsuleComponent->InitCapsuleSize(100,100); static ConstructorHelpers::FObjectFinder<USkeletalMesh> pinkMesh(TEXT("/Game/Meshes/BonedSphereTest.BonedSphereTest")); Mesh->SetSkeletalMesh(pinkMesh.Object); // Create a camera boom attached to the root (ball) SpringArm = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("SpringArm0")); SpringArm->AttachTo(RootComponent); SpringArm->bDoCollisionTest = false; SpringArm->bAbsoluteRotation = true; // Rotation of the ball should not affect rotation of boom SpringArm->RelativeRotation = FRotator(-20.f, 0.f, 0.f); SpringArm->TargetOffset = FVector(0.f,0.f,0.f); SpringArm->TargetArmLength = 1200.f; SpringArm->bEnableCameraLag = false; SpringArm->CameraLagSpeed = 3.f; // Create a camera and attach to boom Camera = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("Camera0")); Camera->AttachTo(SpringArm, USpringArmComponent::SocketName); Camera->bUseControllerViewRotation = false; // We don't want the controller rotating the camera CharacterMovement->bOrientRotationToMovement = true; // Face in the direction we are moving.. CharacterMovement->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate CharacterMovement->GravityScale = 2.f; CharacterMovement->AirControl = 0.80f; CharacterMovement->JumpZVelocity = 1200.f; CharacterMovement->GroundFriction = 3.f; CharacterMovement->MaxWalkSpeed = 600.f; CharacterMovement->MaxFlySpeed = 600.f;
It looks like it may have something to do with my test mesh… I have no idea why, but when I switched to using a different mesh (the character mesh that is the default in the code third person), the twitching stopped. Here is my test mesh . What did I do wrong?
And I figured it out. I don’t entirely know what a PhysicsAsset is or why it created one on import, but once I removed the reference to the PhysicsAsset on my skinned mesh, it now doesn’t twitch.
Titirez5, I figured it out, but would greatly appreciate an explanation on why it worked if you know why (see my answer).