<%= "" %> model://sun model://ground_plane 0 1 -9.81 <% # Test pyramid friction model # Set asymmetric friction coefficients and friction direction # Then apply lateral gravity component and watch the angle that boxes slide # Also add some sphere and spin them to make sure friction directions # are in the body-fixed frame require 'matrix' def a_to_s(v) Array(v).join(" ") end sphere = {} sphere[:radius] = 0.25 sphere[:mass] = 1 sphere[:ixx] = 0.4 * sphere[:mass] * sphere[:radius]**2 sphere[:iyy] = sphere[:ixx] sphere[:izz] = sphere[:ixx] sphere[:y0] = 3 %> 0 <%= sphere[:y0] %> <%= sphere[:radius] %> 0 0 0 <%= sphere[:mass] %> <%= sphere[:ixx] %> 0 0 <%= sphere[:iyy] %> 0 <%= sphere[:izz] %> <%= sphere[:radius] %> 100 0 1 0 0 <%= sphere[:radius] %> 0 1 0 0 0 0 <%= sphere[:mass] %> <%= sphere[:ixx] %> 0 0 <%= sphere[:iyy] %> 0 <%= sphere[:izz] %> <%= sphere[:radius] %> 100 0 1 0 0 <%= sphere[:radius] %> <% # box dimensions dx = 0.5 dy = dx dz = 0.2 box = {} box[:size] = Vector[dx, dy, dz] box[:mass] = 1 box[:ixx] = box[:mass] / 12.0 * (dy**2 + dz**2) box[:iyy] = box[:mass] / 12.0 * (dz**2 + dx**2) box[:izz] = box[:mass] / 12.0 * (dx**2 + dy**2) box_count = 10 box_angles = Math::PI * Vector[*(0..box_count)] / box_count rings = {} rings["fdir"] = {:radius => 5} rings["collision"] = {:radius => 6} rings["link"] = {:radius => 7} rings["model"] = {:radius => 8} ring_name = "fdir" ring = rings[ring_name] box_angles.each_with_index do |a,i| name = "box_#{ring_name}_#{i}" pos_xy = ring[:radius] * Vector[Math.cos(a), Math.sin(a)] fdir = Vector[-Math.sin(a), Math.cos(a)] %> <%= a_to_s(pos_xy) %> 0.1 0 -0 0 <%= box[:mass] %> <%= box[:ixx] %> 0 0 <%= box[:iyy] %> 0 <%= box[:izz] %> <%= a_to_s(box[:size]) %> 100 0 <%= a_to_s(fdir) %> 0 <%= a_to_s(box[:size]) %> <% end ring_name = "collision" ring = rings[ring_name] box_angles.each_with_index do |a,i| name = "box_#{ring_name}_#{i}" pos_xy = ring[:radius] * Vector[Math.cos(a), Math.sin(a)] %> <%= a_to_s(pos_xy) %> 0.1 0 -0 0 <%= box[:mass] %> <%= box[:ixx] %> 0 0 <%= box[:iyy] %> 0 <%= box[:izz] %> <%= a_to_s(box[:size]) %> 0 0 0 0 0 <%= a %> 100 0 0 1 0 <%= a_to_s(box[:size]) %> 0 0 0 0 0 <%= a %> <% end ring_name = "link" ring = rings[ring_name] box_angles.each_with_index do |a,i| name = "box_#{ring_name}_#{i}" pos_xy = ring[:radius] * Vector[Math.cos(a), Math.sin(a)] %> <%= a_to_s(pos_xy) %> 0.1 0 -0 0 0 0 0 0 0 <%= a %> <%= box[:mass] %> <%= box[:ixx] %> 0 0 <%= box[:iyy] %> 0 <%= box[:izz] %> <%= a_to_s(box[:size]) %> 100 0 0 1 0 <%= a_to_s(box[:size]) %> <% end ring_name = "model" ring = rings[ring_name] box_angles.each_with_index do |a,i| name = "box_#{ring_name}_#{i}" pos_xy = ring[:radius] * Vector[Math.cos(a), Math.sin(a)] %> <%= a_to_s(pos_xy) %> 0.1 0 -0 <%= a %> <%= box[:mass] %> <%= box[:ixx] %> 0 0 <%= box[:iyy] %> 0 <%= box[:izz] %> <%= a_to_s(box[:size]) %> 100 0 0 1 0 <%= a_to_s(box[:size]) %> <% end %> -0.93396 -19.9626 11.7572 0 0.503643 1.6562 orbit perspective