There are a camera and a point that the camera is looking at.
I want to move the camera closing to the point on the planeXY following a black line.
Does it use normalizing? Please show me some code…
I don’t know how you want to move it there, so I use interval :
from pandac.PandaModules import Vec3
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
def goThere():
if camHprIval.isPlaying():
return
# vector from camera to smiley
vec=smiley.getPos()-camera.getPos()
# approaches until 90% of the distance
dist=.9
camera.posInterval(.5,camera.getPos()+vec*dist, blendType='easeOut').start()
DO.ignoreAll()
DO=DirectObject()
DO.acceptOnce('space',goThere)
smiley=loader.loadModelCopy('smiley')
smiley.reparentTo(render)
smiley.setPos(10,70,5)
camera.lookAt(smiley)
camHprIval=camera.hprInterval(1,camera.getHpr(), Vec3(0,0,0), blendType='easeOut')
camHprIval.start()
base.disableMouse()
run()