Attributes in arena-py
Attributes are used to specify parameters for ARENA Objects.
See object definition reference.
Accessing Object Attributes
See Appendix for all types of Attributes.
Usually, attributes (except for object_id
, persist
, ttl
, and parent
) are under the data
field:
obj.object_id
obj.persist
...
obj.data.position
obj.data.rotation
...
obj.data.material
# etc etc
All Attributes
Position
The position of an object can be specified by:
position=Position(x, y, z)
# or
position=(x, y, z)
Rotation
The rotation (in euler coordinates) of an object can be specified by:
rotation=Rotation(x, y, z)
# or
rotation=(x, y, z)
The rotation (in quaternions) of an object can be specified by:
rotation=Rotation(x, y, z, w) # note the additional "w" field
# or
rotation=(x, y, z, w)
Warning
All units for euler rotation are in degrees and quaternion rotation are in radians!
Scale
The scale of an object can be specified by:
scale=Scale(x, y, z)
# or
scale=(x, y, z)
Color
The color of an object can be specified by:
color=Color(red, green, blue)
# or
color=(red, green, blue)
Material
The material (transparency and color) of an object can be set by:
material=Material(color, transparent, opacity, ...)
Animation
An animation and/or an animation-mixer can be added to an object:
Sound
A sound can be added to an object using:
sound=Sound(positional, poolSize, autoplay, src, ...)
GotoUrl
Goes to a url on click.
goto_url=GotoUrl(dest, on, url)
Warning
click-listener must be True for this to work!
Impulse
An impulse can be added by:
impulse=Impulse(on, force, position)
Physics
Physics (“none”, “static”, or “dynamic”) can be added with:
physics=Physics(type)
or
dynamic_body=Physics(type)
Text Input
Text input can be added using a keyboard with:
text_input=TextInput(on, title, label, placeholder)
Generic attribute
For attributes that are not specified by the library, you can use this (put anything you want in the “…”)! Inherit from this class to create custom attributes.
Attribute(...)
Additional Attributes (which are just specified as numbers or strings) may include persist, ttl, clickable, etc:
persist=True
ttl=30 # seconds
clickable=True
# click_listener=True works too
# etc.