extraArgs=[steerPlugIn],
                    appendTask=True)

    # DEBUG DRAWING: make the debug reference node paths sibling of the reference node
    steerMgr.get_reference_node_path_debug().reparent_to(app.render)
    steerMgr.get_reference_node_path_debug_2d().reparent_to(app.aspect2d)
    # enable debug drawing
    steerPlugIn.enable_debug_drawing(app.camera)

    # # set events' callbacks
    # toggle debug draw
    toggleDebugFlag = False
    app.accept("d", toggleDebugDraw, [steerPlugIn])

    # handle addition steer vehicles, models and animations
    wandererData = HandleVehicleData(0.7, 0, "kinematic", sceneNP, steerPlugIn,
                                     steerVehicles, vehicleAnimCtls)
    app.accept("w", addWanderer, [wandererData])
    pursuerData = HandleVehicleData(0.7, 1, "kinematic", sceneNP, steerPlugIn,
                                    steerVehicles, vehicleAnimCtls)
    app.accept("p", addPursuer, [pursuerData])

    # increase/decrease last inserted vehicle's max speed
    app.accept("s", changeVehicleMaxSpeed, ["s", steerVehicles])
    app.accept("shift-s", changeVehicleMaxSpeed, ["shift-s", steerVehicles])
    # increase/decrease last inserted vehicle's max force
    app.accept("f", changeVehicleMaxForce, ["f", steerVehicles])
    app.accept("shift-f", changeVehicleMaxForce, ["shift-f", steerVehicles])

    # write to bam file on exit
    app.win.set_close_request_event("close_request_event")
    app.accept("close_request_event", writeToBamFileAndExit, [bamFileName])
Beispiel #2
0
                    extraArgs=[steerPlugIn],
                    appendTask=True)

    # DEBUG DRAWING: make the debug reference node paths sibling of the reference node
    steerMgr.get_reference_node_path_debug().reparent_to(app.render)
    steerMgr.get_reference_node_path_debug_2d().reparent_to(app.aspect2d)
    # enable debug drawing
    steerPlugIn.enable_debug_drawing(app.camera)

    # # set events' callbacks
    # toggle debug draw
    toggleDebugFlag = False
    app.accept("d", toggleDebugDraw, [steerPlugIn])

    # handle addition steer vehicles, models and animations
    playerAData = HandleVehicleData(0.7, 0, "kinematic", sceneNP, steerPlugIn,
                                    steerVehicles, vehicleAnimCtls)
    app.accept("a", addPlayerA, [playerAData])
    playerBData = HandleVehicleData(0.7, 1, "kinematic", sceneNP, steerPlugIn,
                                    steerVehicles, vehicleAnimCtls)
    app.accept("b", addPlayerB, [playerBData])
    ballData = HandleVehicleData(0.7, 3, "kinematic", sceneNP, steerPlugIn,
                                 steerVehicles, vehicleAnimCtls)
    app.accept("p", addBall, [ballData])

    # handle OSSteerVehicle(s)' events
    app.accept("avoid_neighbor", handleVehicleEvent, ["avoid_neighbor"])

    # write to bam file on exit
    app.win.set_close_request_event("close_request_event")
    app.accept("close_request_event", writeToBamFileAndExit, [bamFileName])
    app.taskMgr.add(updatePlugIn, "updatePlugIn", extraArgs=[steerPlugIn], 
                    appendTask=True)

    # DEBUG DRAWING: make the debug reference node paths sibling of the reference node
    steerMgr.get_reference_node_path_debug().reparent_to(app.render)
    steerMgr.get_reference_node_path_debug_2d().reparent_to(app.aspect2d)
    # enable debug drawing
    steerPlugIn.enable_debug_drawing(app.camera)

    # # set events' callbacks
    # toggle debug draw
    toggleDebugFlag = False
    app.accept("d", toggleDebugDraw, [steerPlugIn])

    # handle addition steer vehicles, models and animations 
    vehicleData = HandleVehicleData(0.7, 0, "opensteer", sceneNP, 
                        steerPlugIn, steerVehicles, vehicleAnimCtls)
    app.accept("a", handleVehicles, [vehicleData])
    vehicleDataKinematic = HandleVehicleData(0.7, 1, "kinematic", sceneNP, 
                        steerPlugIn, steerVehicles, vehicleAnimCtls)
    app.accept("k", handleVehicles, [vehicleDataKinematic])

    # handle obstacle addition
    obstacleAddition = HandleObstacleData(True, sceneNP, steerPlugIn,
                        LVecBase3f(0.03, 0.03, 0.03))
    app.accept("o", handleObstacles, [obstacleAddition])
    # handle obstacle removal
    obstacleRemoval = HandleObstacleData(False, sceneNP, steerPlugIn)
    app.accept("shift-o", handleObstacles, [obstacleRemoval])

    # increase/decrease last inserted vehicle's max speed
    app.accept("s", changeVehicleMaxSpeed, ["s", steerVehicles])
Beispiel #4
0
                    appendTask=True)

    # DEBUG DRAWING: make the debug reference node paths sibling of the reference node
    steerMgr.get_reference_node_path_debug().reparent_to(app.render)
    steerMgr.get_reference_node_path_debug_2d().reparent_to(app.aspect2d)
    # enable debug drawing
    steerPlugIn.enable_debug_drawing(app.camera)

    # # set events' callbacks
    # toggle debug draw
    toggleDebugFlag = False
    app.accept("d", toggleDebugDraw, [steerPlugIn])

    # handle addition steer vehicles, models and animations
    vehicleData = HandleVehicleData(0.007, 2, "opensteer", sceneNP,
                                    steerPlugIn, steerVehicles,
                                    vehicleAnimCtls, LVector3f(0.0, 0.0, 25.0))
    app.accept("a", handleVehicles, [vehicleData])

    # handle obstacle addition
    obstacleAddition = HandleObstacleData(True, sceneNP, steerPlugIn,
                                          LVecBase3f(0.03, 0.03, 0.24))
    app.accept("o", handleObstacles, [obstacleAddition])
    # handle obstacle removal
    obstacleRemoval = HandleObstacleData(False, sceneNP, steerPlugIn)
    app.accept("shift-o", handleObstacles, [obstacleRemoval])

    # increase/decrease last inserted vehicle's max speed
    app.accept("s", changeVehicleMaxSpeed, ["s", steerVehicles])
    app.accept("shift-s", changeVehicleMaxSpeed, ["shift-s", steerVehicles])
    # increase/decrease last inserted vehicle's max force
                    extraArgs=[steerPlugIn],
                    appendTask=True)

    # DEBUG DRAWING: make the debug reference node paths sibling of the reference node
    steerMgr.get_reference_node_path_debug().reparent_to(app.render)
    steerMgr.get_reference_node_path_debug_2d().reparent_to(app.aspect2d)
    # enable debug drawing
    steerPlugIn.enable_debug_drawing(app.camera)

    # # set events' callbacks
    # toggle debug draw
    toggleDebugFlag = False
    app.accept("d", toggleDebugDraw, [steerPlugIn])

    # handle addition steer vehicles, models and animations
    seekerData = HandleVehicleData(1.2, 0, "kinematic", sceneNP, steerPlugIn,
                                   steerVehicles, vehicleAnimCtls)
    app.accept("a", addSeeker, [seekerData])
    enemyData = HandleVehicleData(1.2, 1, "kinematic", sceneNP, steerPlugIn,
                                  steerVehicles, vehicleAnimCtls)
    app.accept("e", addEnemy, [enemyData])

    # set home base center
    app.accept("h", setHomeBaseCenter, [flagNP])

    # handle obstacle addition
    obstacleAddition = HandleObstacleData(True, sceneNP, steerPlugIn,
                                          LVecBase3f(0.05, 0.05, 0.08))
    app.accept("o", handleObstacles, [obstacleAddition])
    # handle obstacle removal
    obstacleRemoval = HandleObstacleData(False, sceneNP, steerPlugIn)
    app.accept("shift-o", handleObstacles, [obstacleRemoval])
Beispiel #6
0
    # DEBUG DRAWING: make the debug reference node paths sibling of the reference node
    steerMgr.get_reference_node_path_debug().reparent_to(app.render)
    steerMgr.get_reference_node_path_debug_2d().reparent_to(app.aspect2d)
    # enable debug drawing
    steerPlugIn.enable_debug_drawing(app.camera)
    # print debug draw to texture
    app.accept("t", debugDrawToTexture)
    app.accept("debug_drawing_texture_ready", onTextureReady, [rttTexStage])

    # # set events' callbacks
    # toggle debug draw
    toggleDebugFlag = False
    app.accept("d", toggleDebugDraw, [steerPlugIn])

    # handle addition steer vehicles, models and animations
    vehicleData = HandleVehicleData(0.4, 4, "kinematic", sceneNP, steerPlugIn,
                                    steerVehicles, vehicleAnimCtls)
    app.accept("a", handleVehicles, [vehicleData])

    # handle obstacle addition
    obstacleAddition = HandleObstacleData(True, sceneNP, steerPlugIn,
                                          LVecBase3f(0.03, 0.03, 0.03))
    app.accept("o", handleObstacles, [obstacleAddition])
    # handle obstacle removal
    obstacleRemoval = HandleObstacleData(False, sceneNP, steerPlugIn)
    app.accept("shift-o", handleObstacles, [obstacleRemoval])

    # increase/decrease last inserted vehicle's max speed
    app.accept("s", changeVehicleMaxSpeed, ["s", steerVehicles])
    app.accept("shift-s", changeVehicleMaxSpeed, ["shift-s", steerVehicles])
    # increase/decrease last inserted vehicle's max force
    app.accept("f", changeVehicleMaxForce, ["f", steerVehicles])