Module: Bullet3

Defined in:
lib/bullet3.rb,
lib/bullet3/io.rb,
lib/bullet3/data.rb,
lib/bullet3/vehicle.rb,
lib/bullet3/version.rb,
lib/bullet3/dynamics.rb,
lib/bullet3/collision.rb,
lib/bullet3/soft_body.rb,
lib/bullet3/debug_draw.rb,
lib/bullet3/multi_body.rb,
lib/bullet3/simulation.rb,
lib/bullet3/constraints.rb,
lib/bullet3/linear_math/vector3.rb,
lib/bullet3/linear_math/matrix3x3.rb,
lib/bullet3/linear_math/transform.rb,
lib/bullet3/linear_math/quaternion.rb

Defined Under Namespace

Modules: Constraints, Data, IO, MultiBody, Shapes, SoftBody Classes: DebugDraw, Error, Matrix3x3, Quaternion, Simulation, Transform, Vector3

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.native_load_errorObject (readonly)

Returns the value of attribute native_load_error.



9
10
11
# File 'lib/bullet3.rb', line 9

def native_load_error
  @native_load_error
end

Class Method Details

.load_native_extension(required: false) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bullet3.rb', line 15

def load_native_extension(required: false)
  return true if native?
  return false if ENV["BULLET3_SKIP_NATIVE"] == "1" && !required

  require "bullet3/bullet3"
  true
rescue LoadError => error
  @native_load_error = error
  raise if required || ENV["BULLET3_REQUIRE_NATIVE"] == "1"

  false
end

.native?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/bullet3.rb', line 11

def native?
  const_defined?(:DiscreteDynamicsWorld, false)
end

.require_native_extension!(feature) ⇒ Object

Raises:



28
29
30
31
32
33
# File 'lib/bullet3.rb', line 28

def require_native_extension!(feature)
  return true if load_native_extension

  detail = native_load_error ? " #{native_load_error.message}" : ""
  raise Error, "native extension is required for #{feature}. Run `bundle exec rake compile` before using it.#{detail}"
end