Download

Make pawn collide and move other objects

Hello!

I’m new to unreal and I’m trying to port a game that I’ve been developing in Unity but I’m having some difficulties.
So I have a character that is supposed to slide across a surface (like ice) and push other objects that should slide as well. Right now I’m mixing C++ and Blueprints so my character as the components created in the blueprint and everything else I’m coding. What I have is a character that derives from the class APawn and has a box collision component that inside has a skeletal mesh component and has a floating pawn component as well. The box collision is physics enabled and I manage to achieve the right behavior for my character movement with the floating point movement component. However now I tried to add an object to the scene (similar to my character with a box collision with physics enabled) but once the two collide it’s like colliding to a wall, the object doesn’t move. Any idea for what I might be doing wrong?
Here is the code for making my character move:


void AHero::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

	const FVector MoveDirection = FVector(x_value, y_value, 0.f).GetClampedToMaxSize(1.0f);
	//const float MoveSpeed = 20.0f;
	
	if (movement_component != NULL) {
		const FVector Movement = MoveDirection * movement_component->MaxSpeed * DeltaTime;

		if (Movement.SizeSquared() > 0.0f)
		{
			movement_component->AddInputVector(Movement);
			GEngine->AddOnScreenDebugMessage(0, 15.0f, FColor::Red, movement_component->Velocity.ToString());
		}
	}

}

I really hope someone can help me.
Thank a lot in advance.
Cheers.

When simulating physics the mass plays an important role , you can see mass of the components in their details tab and even change it, the mass depends on visible size and material applied to the object. So if your object is way too heavy than your player then there is no chance you can move it without moving very fast simply because of laws of physics.

Thank you so much for the quick response.
I tried that, I made the pushed objects with a mass very very small, and still they don’t move when they collide. I managed to make things working by adding force to the box collider instead of adding the input vector to the floating pawn component, and now the character moves and the objects get pushed (I removed the floating pawn component as well).
Still I cannot understand why the previous approach didn’t work.

A box collision is a wireframe box it would not cause actor to move unless its the root component and it’ll not cause the mesh to move unless the mesh is its child component.

So I think you either need to make the mesh child of the box collision or enable physics on the mesh (if your mesh has collision data)

Yes the box is the Root component. I managed to make my character move and push other objects by simply adding an impulse to the box collision and removing the floating pawn component, but now I have another problem.

What I really wanted was to have a cylinder collision, but since that is not possible I’m making the box collide with the ground and added another sphere collision as child of the box. This sphere is the one that I want to push other objects and the box I want it to collide with the ground and have a physics material (to simulate an ice surface), however when I enable physics on the sphere it no longer follows the parent root (if I enable gravity the sphere just keeps falling and if I disable gravity the sphere just stays in the same place and it’s not affected by the impulse I gave to the box).

Any ideias on how to solve this? Thank you very much for the help.