Similar to Sprite
which is in 2D.
Each actor associates a model
to the position center
.
The appearance is modified by rotation
, scale
and alpha
,
as well as the attributes of model
itself.
import gamnit::depth
# Load model from the assets folder
var model = new Model("path/in/assets.obj")
# Create and configure an actor
var actor = new Actor(model, new Point3d[Float](0.0, 0.0, 0.0))
actor.scale = 2.0
# Add to the visible game world
app.actors.add actor
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
gamnit :: Actor :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Visible 3D entity in the game world
#
# Similar to `gamnit::Sprite` which is in 2D.
#
# Each actor associates a `model` to the position `center`.
# The appearance is modified by `rotation`, `scale` and `alpha`,
# as well as the attributes of `model` itself.
#
# ~~~
# import gamnit::depth
#
# # Load model from the assets folder
# var model = new Model("path/in/assets.obj")
#
# # Create and configure an actor
# var actor = new Actor(model, new Point3d[Float](0.0, 0.0, 0.0))
# actor.scale = 2.0
#
# # Add to the visible game world
# app.actors.add actor
# ~~~
class Actor
# Model used to draw this actor
var model: Model
# Position of this sprite in world coordinates
var center: Point3d[Float] is writable
# Rotation around the X axis (+ looks up, - looks down)
#
# Positive values look up, and negative look down.
#
# All actor rotations follow the right hand rule.
# The default orientation of the model should look towards -Z.
var pitch = 0.0 is writable
# Rotation around the Y axis (+ turns left, - turns right)
#
# Positive values turn `self` to the left, and negative values to the right.
#
# All actor rotations follow the right hand rule.
# The default orientation of the model should look towards -Z.
var yaw = 0.0 is writable
# Rotation around the Z axis (looking to -Z: + turns counterclockwise, - clockwise)
#
# From the default camera point of view, looking down on the Z axis,
# positive values turn `self` counterclockwise, and negative values clockwise.
#
# All actor rotations follow the right hand rule.
# The default orientation of the model should look towards -Z.
var roll = 0.0 is writable
# Scale applied to the model
var scale = 1.0 is writable
# Transparency applied to the model on draw
#
# This value may be ignored by some materials.
# Non-opaque values may result in artifacts as there is no specialized
# support for transparent models and the depth buffer.
var alpha = 1.0 is writable
end
lib/gamnit/depth/depth_core.nit:20,1--83,3