When a LerpQuatInterval is playing on an object it sometimes disappears when it is near the edge of the screen. The code I’m using moves an object between two points and performs a quick rotation to face the proper heading.
#move object between two points def objMove(self, startPos, endPos, what): v = endPos-startPos self.interval.pause() #finish caused undesirable teleport to previous endpoint del self.interval moveInt = LerpPosInterval(what, calcTime(v), endPos, startPos) h = calcH(v) q = Quat() q.setHpr(Point3(h, 0.0, 0.0)) qInt = LerpQuatInterval(what, 0.2, q, blendType='easeIn') self.interval = Parallel(moveInt, qInt) self.interval.start()
In the previous code calcH calculates the appropriate heading, and calcTime calculates the time it would take to travel the vector’s length at a predefined speed, both of those functions work correctly and the effect is the one I want.
At first I thought it only happened when the change in heading was 180Âº, but I noticed it also sometimes happens with other changes that are aproximately only 90Âº
Anyone have any idea what could be wrong here? Did I make some trivial mistake?