mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
DISABLED collision detection and physics
This commit is contained in:
@@ -56,16 +56,16 @@ class IMICFPS
|
||||
broadphase.each do |entity, _collisions|
|
||||
_collisions.each do |ent|
|
||||
# aabb vs aabb
|
||||
next unless entity.bounding_box.intersect?(ent.bounding_box)
|
||||
# next unless entity.bounding_box.intersect?(ent.bounding_box)
|
||||
# entity model aabb tree vs ent model aabb tree
|
||||
ent_tree_search = ent.model.aabb_tree.search(localize_entity_bounding_box(entity, ent), true)
|
||||
next if ent_tree_search.size == 0
|
||||
# ent_tree_search = ent.model.aabb_tree.search(localize_entity_bounding_box(entity, ent), true)
|
||||
# next if ent_tree_search.size == 0
|
||||
|
||||
# puts "#{ent.class} -> #{ent_tree_search.size} (#{Gosu.milliseconds})"
|
||||
|
||||
entity.position.y = ent_tree_search.first.object.vertices.first.y if entity.is_a?(Player) && ent.is_a?(Terrain)
|
||||
# entity.position.y = ent_tree_search.first.object.vertices.first.y if entity.is_a?(Player) && ent.is_a?(Terrain)
|
||||
|
||||
@collisions[entity] = _collisions
|
||||
# @collisions[entity] = _collisions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,6 +32,7 @@ class IMICFPS
|
||||
entity.velocity.y = 0
|
||||
else
|
||||
entity.velocity.y -= @collision_manager.map.gravity * entity.delta_time if entity.manifest.physics
|
||||
entity.velocity.y = 0 if entity.velocity.y < 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ class IMICFPS
|
||||
end
|
||||
|
||||
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
||||
build_collision_tree
|
||||
# build_collision_tree
|
||||
puts " Building mesh collision tree took #{((Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)-start_time)/1000.0).round(2)} seconds" if $debug.get(:stats)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user