Scene#
A scene datablock: its placed objects (objects, roots), its collections and a raycast against the authored meshes. Create one with plupy.data.scenes.new(name); the scene being edited is plupy.context.scene.
class Scene(DataBlock)Inherits DataBlock: its members are documented there.
Usage and examples
Members: objects · roots · collections · find_path · raycast
objects#
objects -> Uses # read-onlyAll resolved scene uses. add() places a root use; children.add() nests a use.
roots#
roots -> Uses # read-onlyRoot uses only.
collections#
collections -> SceneCollections # read-onlyOrganizational groups of root uses.
find_path#
find_path(start: tuple, destination: tuple) -> dictFind a static 3D walking route using this scene's current bake.
Returns status, world-space points and projected_destination. Only Complete is followable; disconnected, invalid or missing surfaces return an explicit status. Bake with plupy.ops.bake_navigation(scene=self) after editing navigation sources or settings.
raycast#
raycast(origin: tuple, direction: tuple, *, max_distance: float | None=None, ignore: Use | None=None) -> dict | NoneThe first mesh surface along a ray, from the authored scene (no gameplay runs), or None.
origin and direction are (x, y, z); direction (0, -1, 0) looks straight down. ignore skips one use and its children. Returns a dict: point, normal, distance and use (the placement hit).
The first mesh surface a ray meets in this scene, measured from the authored data as the Scene View draws it (no gameplay script runs and physics bodies are not needed). origin and direction are (x, y, z); (0, -1, 0) looks straight down. ignore skips one use and its children, for example the object being placed. Returns None when nothing is hit, otherwise a dict: point and normal (tuples, world space), distance (metres) and use (the placement hit). Both faces of a triangle count. Inactive objects are skipped.
scene = plupy.data.scenes["Main"]
hit = scene.raycast((4, 50, -2), (0, -1, 0))
ground = hit["point"][1] if hit else 0.0 # height of whatever is under x 4, z -2Related types#
DataBlock · SceneCollections · Use · Uses
Source#
- _live.py:971