# PlayerMovementScript - UnexpectedChar: 0xAD

**URL:** https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350
**Category:** Scripting
**Tags:** Scripting
**Created:** [April 26, 2013, 1:05pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350 "2013-04-26T13:05:00Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![SkaciuPL](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@SkaciuPL](https://discussions.unity.com/u/SkaciuPL)
#### Post date: [April 26, 2013, 1:05pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350/1 "2013-04-26T13:05:00Z")

</div>

Hello! It’s my first post. I have problem. I wrote PlayerMovementScript, and when i running the game, i’ve error: Unexpected Char: 0xAD (7,41) What i done wrong? Sorry for my English, but i’m from Poland.

_PlayerMovementScript:_

```auto
var cameraObject : GameObject;
var acceleration : float = 10;

function Update(){

transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MosueLookScript).currentYRotation, 0);
rigidbody.AddRelativeForce(Input.GetAxis*("Horizontal") * acceleration, 0, Input.GetAxis("Vertical") * acceleration);

}

```

_MouseLookScript:_

```auto
@HideInInspector
var xRotation : float;
@HideInInspector
var yRotation : float;
var Sensitivity : float = 1;
var Smooth : float = 2;
@HideInInspector
var currentXRotation : float;
@HideInInspector
var currentYRotation : float;
@HideInInspector
var xRotationV : float;
@HideInInspector
var yRotationV : float;

function Update () {

xRotation -= Input.GetAxis("Mouse Y") * Sensitivity;
yRotation += Input.GetAxis("Mouse X") * Sensitivity;

 currentXRotation = Mathf.SmoothDamp( currentXRotation, xRotation, xRotationV, Smooth );
 currentYRotation = Mathf.SmoothDamp( currentYRotation, yRotation, yRotationV, Smooth );
 
 xRotation = Mathf.Clamp( xRotation, -90, 90);

 transform.rotation = Quaternion.Euler( currentXRotation, currentYRotation, 0);
 
}

```

MouseLookScript working. What i must change in (“Horizontal”)?

---

<div class="post-metadata">

### Author: ![yusufulutas](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@yusufulutas](https://discussions.unity.com/u/yusufulutas)
#### Post date: [April 26, 2013, 1:13pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350/2 "2013-04-26T13:13:59Z")

</div>

“MosueLookScript” is it correct ? it is in first code block 6. line  
cameraObject.GetComponent(MosueLookScript).currentYRotation

---

<div class="post-metadata">

### Author: ![SkaciuPL](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@SkaciuPL](https://discussions.unity.com/u/SkaciuPL)
#### Post date: [April 26, 2013, 1:19pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350/3 "2013-04-26T13:19:52Z")

</div>

Oh, i don’t saw that.  
But, i repair this, and error still exist.

@Edit

When i change script:

```auto
rigidbody.AddRelativeForce(Input.GetAxis*("Horizontal") * acceleration, 0, Input.GetAxis("Vertical") * acceleration);

```

to:

```auto
rigidbody.AddRelativeForce(0, 0, 0);

```

Error doesn’t exist!

@Down

Yes, same error when i changed to “Mo **us** eLookScript”

---

<div class="post-metadata">

### Author: ![yusufulutas](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@yusufulutas](https://discussions.unity.com/u/yusufulutas)
#### Post date: [April 26, 2013, 1:23pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350/4 "2013-04-26T13:23:53Z")

</div>

I guess i found the problem  
Input.GetAxis\*(“Horizontal”) the star after GetAxis  
correct version:

```auto
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * acceleration, 0, Input.GetAxis("Vertical") * acceleration);

```

---

<div class="post-metadata">

### Author: ![yusufulutas](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@yusufulutas](https://discussions.unity.com/u/yusufulutas)
#### Post date: [April 26, 2013, 1:30pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350/5 "2013-04-26T13:30:49Z")

</div>

Is it fixed?

---

<div class="post-metadata">

### Author: ![SkaciuPL](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@SkaciuPL](https://discussions.unity.com/u/SkaciuPL)
#### Post date: [April 26, 2013, 1:31pm UTC](https://discussions.unity.com/t/playermovementscript-unexpectedchar-0xad/503350/6 "2013-04-26T13:31:12Z")

</div>

Really thanks! How i don’t see that? Can i get like on this forum?
