# Custom C++ PAWN can't edit physics in editor

**URL:** <https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148>\
**Category:** World Creation\
**Tags:** staticmeshcomponent, unreal-engine, UE4, CPP, question\
**Created:** [June 17, 2015, 4:11pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148 "2015-06-17T16:11:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c6c5dc0d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c6c5dc0d](https://forums.unrealengine.com/u/anonymous_user_c6c5dc0d)\
**Post date:** [June 17, 2015, 4:11pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/1 "2015-06-17T16:11:54Z")

</div>

I have a custom Pawn whose header file is this:

```
UCLASS()
class ORLANDO_API AC_MyPawn : public APawn
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyPawn")
	UStaticMeshComponent * MyStaticMesh;

	// Sets default values for this pawn's properties
	AC_MyPawn (const FObjectInitializer &ObjectInitializer);

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

	// override the event hit as that seems really slow in the blueprints
	virtual void NotifyHit(class UPrimitiveComponent* MyComp, AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit) override;

	virtual bool CanEditSimulatePhysics()
	{
		return true;
	}
};

```

The .cpp is very simple:

```
// Sets default values
AC_MyPawn::AC_MyPawn(const FObjectInitializer &ObjectInitializer)
{
 	// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	// Set my static mesh to the root component
	MyStaticMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("StaticMesh"));
	RootComponent = MyStaticMesh;
}

```

I create a blue print from this, however when I look at it in the editor there seems to be no part to the physics. I can’t set simulate or not, overload mass etc it’s all blank. How can I create a class which I can then edit as a blueprint in the editor?

 ![46772-ustaticmesh.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/7/b/d7bcbe92239e1e71537b127a97377ddbc17388e6.png)

---

<div class="post-metadata">

**Author:** ![HungryDoodles](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HungryDoodles](https://forums.unrealengine.com/u/HungryDoodles)\
**Post date:** [June 17, 2015, 8:37pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/2 "2015-06-17T20:37:47Z")

</div>

Well, APawn haven’t any physics at all. It is just a pawn.  
UPrimitive or UStaticMesh has physics. If you want to make your pawn collide, walk, you need to add some UPrimitive-type component such as UCapsuleComponent. But either way you don’t need to turn on “Simulating physics”, Pawn controlling itself without actual physics. You can try use physics for fun, i don’t know what will happen.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c6c5dc0d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c6c5dc0d](https://forums.unrealengine.com/u/anonymous_user_c6c5dc0d)\
**Post date:** [June 17, 2015, 8:46pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/3 "2015-06-17T20:46:32Z")

</div>

So why if I add a Static Mesh Component to a Blueprint in the editor does it have physics?

---

<div class="post-metadata">

**Author:** ![HungryDoodles](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HungryDoodles](https://forums.unrealengine.com/u/HungryDoodles)\
**Post date:** [June 17, 2015, 8:55pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/4 "2015-06-17T20:55:22Z")

</div>

Static meshes, primitives and something else i don’t know are able to simulate physics. Like i now created a pawn (pure blueprint), there is only “Should Update Physics Volume” parameter. I’am adding Capsule Component (i can do it from .cpp too) and set it as root. Pawn will NOT get any physics, but it’s new component will. Pawn will use this capsule to move, to act. I’am not sure why you need physics in pawn class. Pawn is only a pawn - even not character. It only recieves input, it can be possesed etc.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c6c5dc0d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c6c5dc0d](https://forums.unrealengine.com/u/anonymous_user_c6c5dc0d)\
**Post date:** [June 17, 2015, 10:01pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/5 "2015-06-17T22:01:24Z")

</div>

Sure, which is the same as the c++ sample above? I have a pawn, but add a staticmeshcomoment but still don’t see the simulate physics on that component?

---

<div class="post-metadata">

**Author:** ![HungryDoodles](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HungryDoodles](https://forums.unrealengine.com/u/HungryDoodles)\
**Post date:** [June 18, 2015, 4:57am UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/6 "2015-06-18T04:57:16Z")

</div>

StaticMesh-\>SetSimulatingPhysics(true) in initializator after setting it as a root.  
If it is still not working, so Pawn blocking any physical movement… what is strange…

---

<div class="post-metadata">

**Author:** ![trojanfoe](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/trojanfoe/32/88719_2.png) [@trojanfoe](https://forums.unrealengine.com/u/trojanfoe)\
**Post date:** [November 29, 2015, 7:28pm UTC](https://forums.unrealengine.com/t/custom-c-pawn-cant-edit-physics-in-editor/322148/7 "2015-11-29T19:28:47Z")

</div>

Did you ever find a solution to this issue? I have a Pawn with 3 static meshes connected via sockets. They have collision and I’ve set called `AttachTo()` and `SetSimulatePhysics(true)` on them in `PostInitProperties()` (the actual meshes are set in a blueprint-subclass so this cannot be done in the constructor). The pawn behaves as expected but I’d like to set mass etc from the editor.
