Matter sprite wont change velocity

Hi all,

Im writing a platformer with Matter physics, and am having trouble changing the velocityX of my enemy sprites.

They should march back and forth on a platform, changing direction via raycasting. The raycasting part of the following code works just fine, and the flipX works as well.

The console also logs the change in velocity correctly, but the sprite still falls off the edge of the platform.

Also, once the enemy falls and collides with the next lower platform, it no longer moves unless i hit it with the player sprite. Then it continues in the original x direction.

Does anyone know their way around something like this?

update(time, delta) {

		//debugger  //TODO: check out this shit!!!!!!!!!!!!!!!!!
		if (this.destroyed) return;


		const {ray, hasHit} = this.raycast(this.sprite, this.groundLayer, this.prevX, 80, 5);

		if(!hasHit) {
			this.sprite.setFlipX (!this.flipX);
			console.log('first vel '+this.sprite.body.velocity.x);
			console.log('second vel '+this.sprite.body.velocity.x);



	changeDirection() {console.log('changeDirection');
		this.sprite.setVelocityX(this.speed = -this.speed);