rustic.set_translation()
Compatibility
Supported languages: C, C++, C#, Python, JavaScript, Lua 5.4, Luau, Java, PHP and HTML/inline JavaScript (binding spellings and return shapes differ).
Use a compatible native engine build and the language tools required by your binding. This does not establish browser/mobile export or release qualification for every OS.
The signature below is the shared reference notation; language examples show the actual binding syntax. Question marks mark optional arguments and explicit defaults are shown where recorded. Do not copy reference notation as a typed declaration.
See Feature status and compatibility for API 1.0/1.1 and per-method restrictions. Engine release tags and Docs v0.1 are independent versions.
Signature
rustic.set_translation(x, y, z)
Setup and usage
Read before applying relative movement. Write from Update for presentation movement or FixedUpdate for simulation movement. Do not rewrite an unchanged position every frame.
Parameters
| Variable | Type | Required | Description |
|---|---|---|---|
x | finite number | Yes | Local X relative to the parent. |
y | finite number | Yes | Local Y relative to the parent. |
z | finite number | Yes | Local Z relative to the parent. |
Return and timing
Get returns three numbers. Set returns no entity value. Lua applies the host write immediately; JavaScript/Web defer it until callback completion or a subsequent canonical scene-target resolution; external SDKs commit at the response or a synchronous query flush. See execution behavior.
Execution behavior
Core write timing differs between immediate Lua host calls, deferred JavaScript/Web commands and external SDK query flushes. Scheduled actions advance with the scene clock; synchronous queries evaluate at the call. Follow execution rules and the return/timing notes for this category.
Language examples
Use these snippets inside Start/on_start after generating the Programming Workspace and attaching the script. Python imports rustic, Game and instance from rustic; C++ includes rustic.hpp; C includes rustic.h; C# uses using static Rustic; Java runs inside a Rustic subclass; PHP declares global $rustic, $Game, $instance in its callback. HTML uses an inline script in a ui/ asset. See Lifecycle callbacks for complete registration examples. Public-property examples require a declared integer health property. Scene examples require the named objects to exist before Play.
Lua 5.4
local x, y, z = rustic.get_translation()
rustic.set_translation(x + 1, y, z)JavaScript
const [x, y, z] = rustic.get_translation();
rustic.set_translation(x + 1, y, z);Python
x, y, z = rustic.get_translation()
rustic.set_translation(x + 1, y, z)C++
auto pos = rustic.get_translation();
rustic.set_translation(pos.x + 1.0, pos.y, pos.z);C#
double[] pos = rustic.get_translation();
rustic.set_translation(pos[0] + 1, pos[1], pos[2]);Luau
local x,y,z = rustic.get_translation()
rustic.set_translation(x+1,y,z)C
RusticVector3 p = rustic.get_translation();
rustic.set_translation(p.x+1,p.y,p.z);Java
double[] p = rustic.get_translation();
rustic.set_translation(p[0]+1,p[1],p[2]);PHP
[$x,$y,$z] = $rustic->get_translation();
$rustic->set_translation($x+1,$y,$z);HTML / inline JS
const [x, y, z] = rustic.get_translation();
rustic.set_translation(x + 1, y, z);Shared Transforms constraints
- NaN and infinity are rejected.
- Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.
Errors and debugging
Read the constraints above and the Console diagnostic. Invalid types, non-finite values, stale targets or unavailable native services can fail validation. A failed callback disables the behavior; a failed source reload keeps the last good instance. Exact error messages depend on the language adapter. See Troubleshooting.