Hi,
I have a camera that is reparentTo a cube, so i can drive it whith a collision onto the ground.
Now i’d like my camera to be Pitched acording to the ground’s normal, so my code is :
if (len(entries)>0) and (entries[0].getIntoNode().getName() == "mapwiimotetoile2"):
base.camdad.setZ(entries[0].getSurfacePoint(render).getZ()+5)
normal = entries[0].getSurfaceNormal(base.camdad)
if normal[0] > 1 or -normal[0] < -1 :
camAcc = normal[0]/5
else :
camAcc = 0
base.camdad.setP(base.camdad, camAcc)
, where base.camdad is the father of my camera.
But result of this looks crazy, and i can’t really understand what it does (:oops:) .
I must say i don’t know mutch about normals and their values …
I didn’t found doc or sample about this but i’m sure that someone have ever write such a code.
Thanks in advance