Class: Teien::CapsuleObjectInfo
- Inherits:
-
ObjectInfo
- Object
- ObjectInfo
- Teien::CapsuleObjectInfo
- Defined in:
- lib/teien/ui/std_objects/capsule_object_info.rb,
lib/teien/base_object/std_objects/capsule_object_info.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#material_name ⇒ Object
Returns the value of attribute material_name.
-
#num_rings ⇒ Object
Returns the value of attribute num_rings.
-
#num_seg_height ⇒ Object
Returns the value of attribute num_seg_height.
-
#num_segments ⇒ Object
Returns the value of attribute num_segments.
-
#radius ⇒ Object
Returns the value of attribute radius.
-
#u_tile ⇒ Object
Returns the value of attribute u_tile.
-
#v_tile ⇒ Object
Returns the value of attribute v_tile.
Attributes inherited from ObjectInfo
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(radius, height, num_rings = 8, num_segments = 16, num_seg_height = 1, u_tile = 1.0, v_tile = 1.0) ⇒ CapsuleObjectInfo
constructor
A new instance of CapsuleObjectInfo.
Constructor Details
#initialize(radius, height, num_rings = 8, num_segments = 16, num_seg_height = 1, u_tile = 1.0, v_tile = 1.0) ⇒ CapsuleObjectInfo
Returns a new instance of CapsuleObjectInfo.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 15 def initialize(radius, height, num_rings = 8, num_segments = 16, num_seg_height = 1, u_tile = 1.0, v_tile = 1.0) super() @radius = radius @height = height @num_rings = num_rings @num_segments = num_segments @num_seg_height = num_seg_height @u_tile = u_tile @v_tile = v_tile @material_name = nil end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 7 def height @height end |
#material_name ⇒ Object
Returns the value of attribute material_name.
13 14 15 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 13 def material_name @material_name end |
#num_rings ⇒ Object
Returns the value of attribute num_rings.
8 9 10 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 8 def num_rings @num_rings end |
#num_seg_height ⇒ Object
Returns the value of attribute num_seg_height.
10 11 12 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 10 def num_seg_height @num_seg_height end |
#num_segments ⇒ Object
Returns the value of attribute num_segments.
9 10 11 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 9 def num_segments @num_segments end |
#radius ⇒ Object
Returns the value of attribute radius.
6 7 8 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 6 def radius @radius end |
#u_tile ⇒ Object
Returns the value of attribute u_tile.
11 12 13 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 11 def u_tile @u_tile end |
#v_tile ⇒ Object
Returns the value of attribute v_tile.
12 13 14 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 12 def v_tile @v_tile end |
Class Method Details
.create_physics_object(obj, physics) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/teien/base_object/std_objects/capsule_object_info.rb', line 27 def self.create_physics_object(obj, physics) physics_object = PhysicsObject.new(physics) cShape = Bullet::BtCapsuleShape.new(obj.object_info.radius, obj.object_info.height) inertia = Bullet::BtVector3.new() cShape.calculate_local_inertia(obj.physics_info.mass, inertia) physics_object.set_rigid_body(obj, cShape, inertia) 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 20 21 22 |
# File 'lib/teien/ui/std_objects/capsule_object_info.rb', line 7 def self.create_view_object(obj, view) gen = Procedural::CapsuleGenerator.new() gen.set_radius(obj.object_info.radius).set_height(obj.object_info.height) gen.set_num_rings(obj.object_info.num_rings) gen.set_num_segments(obj.object_info.num_segments) gen.set_num_seg_height(obj.object_info.num_seg_height) gen.set_vtile(obj.object_info.u_tile).set_vtile(obj.object_info.v_tile).realize_mesh(obj.name) entity = view.scene_mgr.create_entity(obj.name) entity.set_cast_shadows(true) entity.set_material_name(obj.object_info.material_name) view_object = ViewObject.new(view) view_object.set_scene_node(entity) return view_object end |