Download

Custom pawn movement component

How exactly do I make a custom pawn movement component with humanoid behavior that obeys gravity (sorta like CharacterMovementComponent)? I’ve been trying to find this out online, but just couldn’t find it so posting it here. I really need a custom pawn movement component due to “sprinting”, so does any1 know about this?

https://docs.unrealengine.com/latest/INT/Programming/Tutorials/Components/2/index.html
I need something like this, only with gravity and slight drifting :smiley:

You can set the gravity of the UStaticMeshComponent :



UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
SphereVisual->SetSimulatePhysics(true);
SphereVisual->SetEnableGravity(true);

I tried that, dosent work tho

I’ll re-write and repost results

This my help you

This won’t work because the Character Movement Component doesn’t directly move the mesh (unless there are network corrections to smooth out) - and to work correctly the Primitive that it updates is not allowed to simulate physics.

@OP:
ShooterGame has an example of a Character Movement Component with Sprinting. It’s relatively easy to do by inheriting from the default CMC and adding movement properties to it. Unreal Tournament does the same thing and has much more advanced movement. I’d look at the source for those.

It’s pretty easy to implement the basic idea of “sprinting”, but I don’t exactly think you get my point. I’m doing sprinting this way, and as far as I know, CharacterMovementComponent dosen’t support different velocities per direction


/** Modifier applied to forward movement */
	UPROPERTY()
		float ForwardSpeedModifier = 1.0f;

	/** Modifier applied to right movement */
	UPROPERTY()
		float RightSpeedModifier = 1.0f;

	/** Modifier applied to backward movement */
	UPROPERTY()
		float BackwardSpeedModifier = 1.0f;

	/** Modifier applied to left movement */
	UPROPERTY()
		float LeftSpeedModifier = 1.0f;

At least, I know for certain that this isn’t possible with a Character, and CMC only supports Characters, I’m gonna have to make my own road with this :'3