touching3D
Canonical ID: scene3d.touching. Nederlands: raakt3D.
Tests geometric contact between two existing named objects, including surfaces. Solidity does not affect the result. Boxes are tested at their actual left-or-right rotation, called yaw. Spheres and upright cylinders with closed ends are tested as their mathematical shapes, even if the drawing uses small flat faces. It returns a Boolean and does not move, separate, delete, or draw either object. It is not a 2D sprite collision function.
See 3D words and camera rules.
Signature
touching3D(first, second)
Arguments
| Parameter | Type | Requirement |
|---|---|---|
first |
Text | Existing valid first object name. |
second |
Text | Existing valid second object name. |
Return value
Boolean.
Example
# language: en
clear3D("black")
sphere3D("a", 1)
sphere3D("b", 1)
position3D("b", 2, 0, 0)
solid3D("b", false)
say touching3D("a", "b")
position3D("b", 3, 0, 0)
say touching3D("a", "b")
Prints true for surface contact, then false after separation.
Notes and common mistakes
Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.
A host is the app or environment running your program. To see a drawing, it needs a renderer, the part that draws on screen. The command-line command pliro run shows text but does not draw these graphics. The host support table explains which effects work in the IDE, browser, native app, and phone preview. A native build reports an unsupported capability instead of leaving it out.
In 3D, +Y points up. Yaw is the left-or-right angle; at zero the camera faces -Z. The world holds at most 256 objects. Changes appear when you call draw3D. An invalid call leaves the world unchanged. Editing requires an existing object name; creating objects and removing an absent name are exceptions. Use the portable color names or hex codes; transparent colors are unavailable here. Version 1 of the phone preview’s communication format does not carry 3D scenes. See the 3D guide for the coordinate rules.
Related entries
clear3D · box3D · sphere3D · cylinder3D · position3D · Programming guides · Host support · Calls and arguments
