3D Platformer Tutorial from 2.6.1 to 3.1

I’ve imported my completed tutorial project from version 2.6.1 to version 3.1. I have a problem in the script, EnemyPoliceGuy.js. In the method, Attack, the animation starts and the Copper turns in the direction of Lerpz. But the Copper doesn’t move. And because he doesn’t move, the magnitude doesn’t change, and the Attack method returns, turning off the attack.

Line 186:
// Just move forward at constant speed
direction = transform.TransformDirection(Vector3.forward * attackSpeed);
print (“direction=”+direction);
characterController.SimpleMove(direction);

direction equals (4.0, 0,0, 0.1). The z value fluctuates a bit.

I haven’t changed anything in the completed tutorial (except for that print statement). It works in version 2.6.1. It doesn’t work in 3.

ok. i understand. use again Unity 2.6.f01. no way : )

Ok, I removed the CharacterController from the Copper Prefab. Then I added another one, and initialized it in various ways to no avail.

So, it looks like a bug in the CharacterController.SimpleMove method. I commented out all the calls to characterController.SimpleMove(…), and replace it with alternate logic as follows.

In Idle(), I simply commented it out. I didn’t replace it with anything.
In Attack(), I replace it with the following lines of code.

Line 161:
delta = (target.position - transform.position);
delta.Normalize();
transform.position = transform.position + (delta * attackSpeed * move * Time.deltaTime);
Line 186:
delta = (target.position - transform.position);
delta.Normalize();
transform.position = transform.position + (delta * attackSpeed * Time.deltaTime);

I supposed I could have Lerp’ed it into position, but no time tonight. If anyone has a better idea, I’m open to suggestions.

I’ve read on an other thread that you can remove the helmet of Copper to make it work again. This worked fine for me :slight_smile:

it seems to be the boxcollider of the helmet