cm_pathChannels.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:CrowdMaster 作者: johnroper100 项目源码 文件源码
def calcRelativeTarget(self, pathEntry, lookahead):
        context = bpy.context

        pathObject = pathEntry.objectName
        radius = pathEntry.radius
        laneSep = pathEntry.laneSeparation
        isDirectional = pathEntry.mode == "directional"
        revDirec = pathEntry.revDirec if isDirectional else None

        kd, bm, pathMatrixInverse, rotation = self.calcPathData(pathObject,
                                                                revDirec)

        vel = self.sim.agents[self.userid].globalVelocity * lookahead
        if vel.x == 0 and vel.y == 0 and vel.z == 0:
            vel = Vector((0, lookahead, 0))
            vel.rotate(bpy.context.scene.objects[self.userid].rotation_euler)
        vel = vel * rotation
        co_find = pathMatrixInverse * \
            context.scene.objects[self.userid].location
        co, index, dist = kd.find(co_find)
        offset = self.followPath(bm, co, index, vel, co_find, radius, laneSep,
                                 isDirectional, pathEntry)

        offset = offset * pathMatrixInverse

        eul = Euler(
            [-x for x in context.scene.objects[self.userid].rotation_euler], 'ZYX')
        offset.rotate(eul)

        return offset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号