How to get table (information) from hull physics shape?

I’m trying to see what information is within a table of a convex shape.

What’s in docs:

local function get_shape_meta()
    local sphere = physics.get_shape("#collisionobject", "my_sphere_shape")
    -- returns a table with sphere.diameter
    return sphere
end

what I’m trying:

function init(self)
	local shape = physics.get_shape("#collisionobject", "hull_main")
	print(shape)
end
ERROR:SCRIPT: main/main.script:2: No shape with name 'hull_main' found
stack traceback:
  [C]:-1: in function get_shape
  main/main.script:2: in function <main/main.script:1>

I was looking into the same thing recently and I don’t think it’s possible:

As a workaround, the file format itself is quite simple so I’ve just been accessing the collisionshape files directly.

Note that they don’t show up in the shapes list as you’re trying to access them - each collision object has a collision_shape property that can reference a single collision shape file.

2 Likes