Closed coblyox closed 3 years ago
Not true, I see it is a getter. Weird.normalize
is a method. Have you tried vector.normalize()
?
import { Vector3 } from 'fivem-js'
const [x, y, z] = GetPedBoneCoords(PlayerPedId(), 31086, 0.0, 0.0, 0.0)
console.log(Vector3.normalize(new Vector3(x, y, z)))
Gives same result.
Hi! Maybe there's some update on this?
I've been extremely busy IRL. I will look at it latest next weekend.
No worries, I thought I would just ask.
Ended up debugging this as GameplayCamera.ForwardVector
wasn't working.
https://github.com/d0p3t/fivem-js/blob/12a1684f39553050345aeab382be54abafad3d11/src/utils/Vector3.ts#L56-L58 https://github.com/d0p3t/fivem-js/blob/12a1684f39553050345aeab382be54abafad3d11/src/utils/Vector3.ts#L121-L123 https://github.com/d0p3t/fivem-js/blob/12a1684f39553050345aeab382be54abafad3d11/src/utils/Vector3.ts#L72-L75
Vector subtracts itself and then multiplies 0 by 0 (due to subtraction). Essentially this.dotProduct(this.subtract(this))
which returns 0 as the length, causing the normalize method to divide by 0.
@niunisas this should be fixed in version 1.5.2
As said by lfshr: This has been fixed in 1.5.2
If there are any remaining issues, please open a new Issue.
Vector3 manipulation doesn't work, for example normalize method / accessor gives null all the time. Because of that, other methods which uses normalize, returns null also.
To Reproduce Steps to reproduce the behavior: Simple code example:
Expected behavior Should return normalized vector, instead returns:
FiveM Client (please complete the following information):
FiveM Server (please complete the following information):