当前位置: 首页>>代码示例>>Python>>正文


Python bpymorse.get_context_object函数代码示例

本文整理汇总了Python中morse.builder.creator.bpymorse.get_context_object函数的典型用法代码示例。如果您正苦于以下问题:Python get_context_object函数的具体用法?Python get_context_object怎么用?Python get_context_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_context_object函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, name=None):
     SensorCreator.__init__(self, name)
     self.camera = Camera("CameraRobot")
     self.camera.name = "CameraRobot"
     self.append(self.camera)
     self.properties(cam_width = 256, cam_height = 256, cam_focal = 35.0,
                     capturing = True, Vertical_Flip = True)
     # set the frequency to 20 Hz
     self.frequency(20)
     # add toggle capture action (`Space` key)
     bpymorse.add_sensor(type="KEYBOARD")
     obj = bpymorse.get_context_object()
     sensor = obj.game.sensors[-1]
     sensor.key = 'SPACE'
     bpymorse.add_controller(type='LOGIC_AND')
     controller = obj.game.controllers[-1]
     bpymorse.add_actuator(type='PROPERTY')
     actuator = obj.game.actuators[-1]
     actuator.mode = 'TOGGLE'
     actuator.property = 'capturing'
     controller.link(sensor = sensor, actuator = actuator)
     # looking in +X
     SensorCreator.rotate(self, x=math.pi/2, z=math.pi/2)
     # append CameraMesh with its textures
     self.append_meshes(['CameraMesh'], "camera")
     self.rotate(z=math.pi)
开发者ID:DAInamite,项目名称:morse,代码行数:26,代码来源:sensors.py

示例2: __init__

 def __init__(self, name=None, cclass="VideoCameraClass", \
              cpath="morse/sensors/video_camera", bname = "video_camera"):
     SensorCreator.__init__(self, name, cpath, cclass, bname)
     camera = Camera("CameraRobot")
     camera.name = "CameraRobot"
     self.append(camera)
     self.properties(cam_width = 256, cam_height = 256, cam_focal = 35.0, \
                     capturing = True, Vertical_Flip = True)
     # set the frequency to 3 (20ips for ticrate = 60Hz)
     self.frequency(3)
     # add toggle capture action (`Space` key)
     bpymorse.add_sensor(type="KEYBOARD")
     obj = bpymorse.get_context_object()
     sensor = obj.game.sensors[-1]
     sensor.key = 'SPACE'
     bpymorse.add_controller(type='LOGIC_AND')
     controller = obj.game.controllers[-1]
     bpymorse.add_actuator(type='PROPERTY')
     actuator = obj.game.actuators[-1]
     actuator.mode = 'TOGGLE'
     actuator.property = 'capturing'
     controller.link(sensor = sensor, actuator = actuator)
     # looking in +x
     self.rotate(x=math.pi/2, z=-math.pi/2)
     # append CameraMesh with its textures
     imported_objects = self.append_meshes(['CameraMesh'], "video_camera")
     # TODO fix the CameraMesh location and rotation in video_camera.blend
     camera_mesh = imported_objects[0]
     camera_mesh.rotation_euler = (math.pi/2, -math.pi/2, 0)
     camera_mesh.location = (0, 0, 0.015)
开发者ID:matrixchan,项目名称:morse,代码行数:30,代码来源:sensors.py

示例3: __init__

    def __init__(self, name=None):
        """ Sensor to detect objects colliding with the current object.

        Doc: https://www.blender.org/manual/game_engine/logic/sensors/collision.html
        """
        SensorCreator.__init__(self, name)
        obj = bpymorse.get_context_object()
        # Sensor, Collision Sensor, detects static and dynamic objects but
        # not the other collision sensor objects.
        obj.game.physics_type = 'SENSOR'
        # Specify a collision bounds type other than the default
        obj.game.use_collision_bounds = True
        obj.scale = (0.02,0.02,0.02)
        # replace Always sensor by Collision sensor
        sensor = obj.game.sensors[-1]
        sensor.type = 'COLLISION'
        # need to get the new Collision Sensor object
        sensor = obj.game.sensors[-1]
        sensor.use_pulse_true_level = True # FIXME doesnt seems to have any effect
        sensor.use_material = False # we want to filter by property, not by material
        # Component mesh (eye sugar)
        mesh = Cube("CollisionMesh")
        mesh.color(.8, .2, .1)
        self.append(mesh)
开发者ID:amiller27,项目名称:morse,代码行数:24,代码来源:sensors.py


注:本文中的morse.builder.creator.bpymorse.get_context_object函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。