Class: Teien::MeshBBObjectInfo
- Inherits:
-
ObjectInfo
- Object
- ObjectInfo
- Teien::MeshBBObjectInfo
- Defined in:
- lib/teien/ui/std_objects/mesh_bb_object_info.rb,
lib/teien/base_object/std_objects/mesh_bb_object_info.rb
Instance Attribute Summary collapse
-
#material_name ⇒ Object
Returns the value of attribute material_name.
-
#mesh_path ⇒ Object
Returns the value of attribute mesh_path.
-
#physics_offset ⇒ Object
Loading mesh only: offset of collision Box.
-
#scale ⇒ Object
Loading mesh only: scales mesh.
-
#size ⇒ Object
Loading mesh only: bounding box size.
-
#view_offset ⇒ Object
Loading mesh only: offset of Mesh.
-
#view_rotation ⇒ Object
Loading mesh only: rotation offset of Mesh.
Attributes inherited from ObjectInfo
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(mesh_path, size, scale = Vector3D.new(1, 1, 1), view_offset = Vector3D.new(0, 0, 0), view_rotation = Quaternion.new(0, 0, 0, 1.0), physics_offset = Vector3D.new(0, 0, 0)) ⇒ MeshBBObjectInfo
constructor
A new instance of MeshBBObjectInfo.
Constructor Details
#initialize(mesh_path, size, scale = Vector3D.new(1, 1, 1), view_offset = Vector3D.new(0, 0, 0), view_rotation = Quaternion.new(0, 0, 0, 1.0), physics_offset = Vector3D.new(0, 0, 0)) ⇒ MeshBBObjectInfo
Returns a new instance of MeshBBObjectInfo.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 14 def initialize(mesh_path, size, scale = Vector3D.new(1, 1, 1), view_offset = Vector3D.new(0, 0, 0), view_rotation = Quaternion.new(0, 0, 0, 1.0), physics_offset = Vector3D.new(0, 0, 0)) super() @size = size @mesh_path = mesh_path @scale = scale @view_offset = view_offset @view_rotation = view_rotation @physics_offset = physics_offset @material_name = nil end |
Instance Attribute Details
#material_name ⇒ Object
Returns the value of attribute material_name.
12 13 14 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 12 def material_name @material_name end |
#mesh_path ⇒ Object
Returns the value of attribute mesh_path.
6 7 8 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 6 def mesh_path @mesh_path end |
#physics_offset ⇒ Object
Loading mesh only: offset of collision Box
11 12 13 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 11 def physics_offset @physics_offset end |
#scale ⇒ Object
Loading mesh only: scales mesh
8 9 10 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 8 def scale @scale end |
#size ⇒ Object
Loading mesh only: bounding box size
7 8 9 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 7 def size @size end |
#view_offset ⇒ Object
Loading mesh only: offset of Mesh
9 10 11 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 9 def view_offset @view_offset end |
#view_rotation ⇒ Object
Loading mesh only: rotation offset of Mesh
10 11 12 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 10 def view_rotation @view_rotation end |
Class Method Details
.create_physics_object(obj, physics) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/teien/base_object/std_objects/mesh_bb_object_info.rb', line 28 def self.create_physics_object(obj, physics) physics_object = PhysicsObject.new(physics) cShape = Bullet::BtBoxShape.new(obj.object_info.size) inertia = Bullet::BtVector3.new() cShape.calculate_local_inertia(obj.physics_info.mass, inertia) physics_object.set_rigid_body(obj, cShape, inertia, obj.object_info.physics_offset) obj.object_info.use_physics = true return physics_object end |
.create_view_object(obj, view) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/teien/ui/std_objects/mesh_bb_object_info.rb', line 7 def self.create_view_object(obj, view) entity = view.scene_mgr.create_entity(obj.name, obj.object_info.mesh_path) entity.set_cast_shadows(true) entity.set_material_name(obj.object_info.material_name) if obj.object_info.material_name view_object = ViewObject.new(view) node = view_object.set_scene_node(entity, obj.object_info.view_offset, obj.object_info.view_rotation) node.set_scale(obj.object_info.size.x * obj.object_info.scale.x, obj.object_info.size.y * obj.object_info.scale.y, obj.object_info.size.z * obj.object_info.scale.z) return view_object end |