# SetStatic gives an error

**URL:** <https://phaser.discourse.group/t/setstatic-gives-an-error/11143>\
**Category:** Phaser 3\
**Created:** [January 30, 2022, 7:39pm UTC](https://phaser.discourse.group/t/setstatic-gives-an-error/11143 "2022-01-30T19:39:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://phaser.discourse.group/u/Steven)\
**Post date:** [January 30, 2022, 7:39pm UTC](https://phaser.discourse.group/t/setstatic-gives-an-error/11143/1 "2022-01-30T19:39:53Z")

</div>

Hello, I am new to phaser. I want to set a body to change a dynamic body to a static body if certain conditions are met. I created a simple example to try to get it working but without luck:

> class NormScene extends Phaser.Scene {  
> constructor(config) {  
> super({ key: ‘NormScene’ })  
> this.config=config;  
> this.ball = null;  
> }
> 
> preload()  
> {}
> 
> create() {
> 
> ```
> let circle = this.add.circle(200,110,50, 0x00FF00 );
> let body = this.matter.add.circle(200,110,50,{
> isStatic: false,                             
> }) ;
> this.ball = this.matter.add.gameObject(circle,body);
> }
> 
> update(time, delta) {
>  
> if(time>1000){
> this.matter.body.setStatic(this.ball, true);
> }
> }
> 
> ```
> 
> }

the error I get is:

Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)  
at Object.Body.setStatic (phaser.js:10815:40)  
at NormScene.update (NormScene.js:23:30)  
at Systems.step (phaser.js:49068:26)  
at SceneManager.update (phaser.js:100289:21)  
at Game.step (phaser.js:162805:20)  
at TimeStep.step (phaser.js:89366:14)  
at step (phaser.js:89613:19)

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://phaser.discourse.group/u/Steven)\
**Post date:** [January 31, 2022, 9:28am UTC](https://phaser.discourse.group/t/setstatic-gives-an-error/11143/2 "2022-01-31T09:28:21Z")

</div>

Ok figured it out after a good night sleeping 🙂

> this.matter.body.setStatic(this.ball, true);

should be

> this.matter.body.setStatic(this.ball.body, true);
