Esempio n. 1
0
                                kwargs.get("property", ""),
                                kwargs.get('normalDirection', NORMAL_TOWARDS_SOURCE),
                                1 if kwargs.get('xray', False) else 0,
                                _DETECT_FACE_HIT))

def detectUvFaceHit(self, sourcePosition, targetPosition, distance, **kwargs):
    '''
    Detects the cross point of an imaginary line from "start" towards "towards" and the
    first face the line crosses. The resulting UvFaceHit contains the object the face belongs to
    as well as the hit point, the face normal, face hit and the uv coordinates in the primary uv set.
    The distance to measure can be modified via the "distance" parameter. If not set the
    measure ends at "towards".

    :param start: position (or KX_GameObject) to measure from
    :param towards: position (or KX_GameObject) to measure towards to
    :param distance: distance to detect along the line (optional)
    :keyword property: property name that an hit object needs to have
    :keyword normalDirection: NORMAL_TOWARDS_SOURCE, NORMAL_FACE_NORMAL
    :keyword xray: True = ignores faces of objects without filter property
                   False = faces of objects without filter property block the measure
    :return: UvFaceHit
    '''
    detector = bge.logic.getCurrentScene().active_camera
    return UvFaceHit(*detector.rayCast(sourcePosition, targetPosition, distance,
                                kwargs.get("property", ""),
                                kwargs.get('normalDirection', NORMAL_TOWARDS_SOURCE),
                                1 if kwargs.get('xray', False) else 0,
                                _DETECT_UV_FACE_HIT))

import mprop; mprop.init()
Esempio n. 2
0
This module provides build-in store/restore and save/load.
'''
__author__ = 'Monster'

import bge


@property
def storedContent(self):
    'A storage that can be saved to file. Store marshallable objects only.'
    return bge.logic.globalDict


@storedContent.setter
def storedContent(self, content):
    bge.logic.globalDict = content


def loadFromFile(self):
    bge.logic.loadGlobalDict()


def saveToFile(self):
    bge.logic.saveGlobalDict()


import mprop

mprop.init()
Esempio n. 3
0
import mprop

@property
def test_read(mod):
    return "got read"

value = None

@test_read.setter
def test_read(mod, value):
    mod.value = value

mprop.init()