Is it possible to customize the physics calculation?

I have the following problem:

When I activate simulate physics on a character that has a capsule for collision detection, then the capsule will fall over. I don’t want to calculate the rotation of the component based on the angular momentum I only want to calculate the position.

So I thought of extending from the UCapsuleComponent and overriding the rotation of the capsulecomponent after every physics tick


USurfCapsuleComponent::USurfCapsuleComponent(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
  this->SetTickGroup(TG_EndPhysics);
  SetComponentTickEnabled(true);
}

void USurfCapsuleComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
  this->SetWorldRotation(FRotator());
}

But it still falls over. How would I customize the physics calculation? Any help is greatly appreciated.

I don’t know if UE4 supports it, but this sort of thing is typically handled by telling the physics simulation to lock rotations around a given axis directly (rather than trying to overwrite stuff later - there are many issues involved with that that are kind of tangential to the topic of your problem, at least, with PhysX).

Now, depending on what version of PhysX UE4 uses, there may be some support for a dynamic character controller, which sounds like what you ultimately want to happen. I have no idea if that’s in the engine or supported, or even if UE4 is using one of the newer PhysX versions that actually has the dynamic character controller (it didn’t at all until semi-recently).

Hopefully someone will chime in and let us know, because that’s exactly what you want, and I have also been interested to hear if the engine supports a dynamic character controller, and what version of PhysX SDK it uses, as not nearly enough games use dynamic character controllers (because it’s hard).