World
World is the Object at the root of the 3D scene.
Functions
Inherited from Object
HideLoads the given item asynchronously and calls the callback once done. The parameter itemName follows the usual naming convention user.item.
This is a function of the global World, to be called as Object:Load(itemName, callback, config).
The config table options are as follows,
- mutable allows to create the item shapes as MutableShape instead of Shape. Default false.
- bakedLight allows to generate baked lighting for the item shapes. Default false.
Adds given Object as a child. Object extensions like Shape or MutableShape are naturally accepted too.
The keepWorld optional parameter, false by default, dictates whether to maintain the child's world or local position and rotation. Keeping world will ensure the object doesn't move in the scene, adjusting its local position/rotation accordingly; keeping local will have the object move in the scene in order to maintain an equivalent local position/rotation relative to its new parent.
local o = Object() local myShape = Shape(Items.someuser.someitem) o:AddChild(myShape)
Unsets parent/child relationship with child parameter. The child ends up being deleted if it has no other references.
The keepWorld optional parameter, false by default, dictates whether to maintain the child's world or local position and rotation. Keeping world will ensure the object doesn't move in the scene, adjusting its local position/rotation accordingly; keeping local will have the object move in the scene in order to maintain an equivalent local position/rotation relative to its new parent.
o:RemoveChild(someChildObject)
Unsets parent/child relationship with all children. Individual children end up being deleted if they have no other references.
The keepWorld optional parameter, false by default, dictates whether to maintain the child's world or local position and rotation. Keeping world will ensure the object doesn't move in the scene, adjusting its local position/rotation accordingly; keeping local will have the object move in the scene in order to maintain an equivalent local position/rotation relative to its new parent.
o:RemoveChildren()
Get child Object at index.
if o.ChildrenCount > 0 then print(o:GetChild(1)) -- prints first child end
Properties
Inherited from Object
Hidenil by default. Can be set to a function that will be triggered when this object begins a collision with another object.
The function is called with 3 parameters:
- the object the callback was set for,
- the other actor in the collision,
- the world normal of the hit surface.
Note: it's not necessary to use all 3 parameters.
object.OnCollisionBegin = function(self, other, normal) print("collision began between", self, " and ", other, " with world normal ", normal) end
nil by default. Can be set to a function that will be triggered when the World ends colliding with another Object.
The function is called with 2 parameters: the object the callback was set for and the other actor in the collision.
object.OnCollisionEnd = function(self, other) print("collision ended between", self, "and", other) end
Size in world units of the shadow cookie projected under the World, default is 0.0 (disabled).
The shadow cookie, also called blob shadow, is a square texture acting as a cheap alternative to projected shadows.
If this value is strictly positive, shadow cookies will be displayed when:
- the scene has no light source,
- the scene has light sources, but they are disabled because the client is using lower quality settings
Shadow cookies can be used as a fallback to your scene shadows for players with low quality settings, of course, you can also use them instead of shadows as a design choice.
Returns number of child Objects.