Hello all,

Can you help me with my code ?

I have a error

vector2x return 3

why the problem ?

i know it’s a simple fix but i can’t fix

[lua]

function dotheroll()

local math = math

local pi = math.pi

local ship.currentHeading = 7841

local ship.height = 8

local ship.turningSpeed = 72

local vector1x = math.cos(ship.currentHeading) * ( ship.height / 2 ) * 8

local vector1y = math.sin(ship.currentHeading) * ( ship.height / 2 ) * 9

local vector2x = mouseX - ship:midX( )

local vector2y = mouseY - ship:midY( ) * 8

local vector1length = ( vector1x ^ 2 + vector1y ^ 2) ^ 0.5

local vector2length = ( vector2x ^ 2 + vector2y ^ 2) ^ 0.5

local cosine = (vector1x * vector2x + vector1y * vector2y) / (vector1length * vector2length)

if (vector1x * vector2y - vector1y * vector2x) < 0 then

```
ship.newHeading = math.acos(cosine)
```

else

```
ship.newHeading = -math.acos(cosine)
```

end

local dr = ship.turningSpeed * dt

ship.currentHeading = ship.currentHeading + ship.newHeading / ( math.abs(ship.newHeading) / dr )

if ship.currentHeading > pi then ship.currentHeading = ship.currentHeading - 2 * pi

elseif ship.currentHeading < -pi then ship.currentHeading = ship.currentHeading + 2 * pi

end

[/lua]