mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Improved terrain collision slightly
This commit is contained in:
@@ -39,7 +39,7 @@ class IMICFPS
|
|||||||
smaller_list.each do |vert|
|
smaller_list.each do |vert|
|
||||||
next if vert.nil?
|
next if vert.nil?
|
||||||
if nearest
|
if nearest
|
||||||
if Gosu.distance(vertex.x, vertex.z, vert.x, vert.z) < Gosu.distance(nearest.x, nearest.z, vert.x, vert.z)
|
if distance(vert, vertex) < distance(vert, nearest)
|
||||||
nearest = vert
|
nearest = vert
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -49,6 +49,10 @@ class IMICFPS
|
|||||||
|
|
||||||
return nearest
|
return nearest
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def distance(vertex, other)
|
||||||
|
return Math.sqrt((vertex.x-other.x)**2 + (vertex.y-other.y)**2 + (vertex.z-other.z)**2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# class IMICFPS
|
# class IMICFPS
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ Camera X:#{@camera.x.round(2)} Y:#{@camera.y.round(2)} Z:#{@camera.z.round(2)}
|
|||||||
Field Of View: #{@camera.field_of_view}
|
Field Of View: #{@camera.field_of_view}
|
||||||
Mouse Sesitivity: #{@camera.mouse_sensitivity}
|
Mouse Sesitivity: #{@camera.mouse_sensitivity}
|
||||||
Faces: #{@number_of_faces}
|
Faces: #{@number_of_faces}
|
||||||
Last Frame: #{delta_time}ms (#{Gosu.fps} fps)
|
Last Frame: #{delta_time*1000.0}ms (#{Gosu.fps} fps)
|
||||||
|
|
||||||
Draw Skydome: #{@draw_skydome}
|
Draw Skydome: #{@draw_skydome}
|
||||||
Debug mode: <c=992200>#{$debug}</c>
|
Debug mode: <c=992200>#{$debug}</c>
|
||||||
|
|||||||
Reference in New Issue
Block a user