How to normalize vec3?

when im pressing w + d, w + a … etc - my speed is 4.2 when actually it should be 3

i can normalize this myself, but is there a function to do this

Of course, I know two options.

from panda3d.core import Vec3

vector_1 = Vec3(34, 4, 12)

vector_2 = Vec3(34, 4, 12)
vector_normalize = vector_2.normalized()

You can find more details here. You need to remember that Vec3 is an alias in python. And in C++ it will be LVector3f.

1 Like