(ctx: &mut ScriptContext<'_, API>)
| 2142 | .clone()).unwrap_or_default()) |
| 2143 | } |
| 2144 | |
| 2145 | fn collision_shape_mesh(shape: Shape3D) -> Option<(&'static str, Transform3D)> { |
| 2146 | let (source, scale) = match shape { |
| 2147 | Shape3D::Cube { size } => ("__cube__", size), |
| 2148 | Shape3D::Sphere { radius } => { |
| 2149 | let d = radius.abs().max(0.0001) * 2.0; |
| 2150 | ("__sphere__", Vector3::new(d, d, d)) |
| 2151 | } |
| 2152 | Shape3D::Capsule { |
| 2153 | radius, |
| 2154 | half_height, |
| 2155 | } => { |
| 2156 | let d = radius.abs().max(0.0001) * 2.0; |
| 2157 | ( |
| 2158 | "__capsule__", |
| 2159 | Vector3::new(d, half_height.abs().max(0.0001) * 2.0 + d, d), |
| 2160 | ) |
| 2161 | } |
| 2162 | Shape3D::Cylinder { |
| 2163 | radius, |
| 2164 | half_height, |
| 2165 | } => { |
| 2166 | let d = radius.abs().max(0.0001) * 2.0; |
| 2167 | ( |
| 2168 | "__cylinder__", |
| 2169 | Vector3::new(d, half_height.abs().max(0.0001) * 2.0, d), |
| 2170 | ) |
| 2171 | } |
| 2172 | Shape3D::Cone { |
| 2173 | radius, |
| 2174 | half_height, |
| 2175 | } => { |
| 2176 | let d = radius.abs().max(0.0001) * 2.0; |
| 2177 | ( |
| 2178 | "__cone__", |
| 2179 | Vector3::new(d, half_height.abs().max(0.0001) * 2.0, d), |
| 2180 | ) |
| 2181 | } |
| 2182 | Shape3D::TriPrism { size } => ("__tri_prism__", size), |
| 2183 | Shape3D::TriangularPyramid { size } => ("__tri_pyr__", size), |
| 2184 | Shape3D::SquarePyramid { size } => ("__sq_pyr__", size), |
| 2185 | Shape3D::TriMesh { .. } => return None, |
| 2186 | }; |
| 2187 | Some(( |
| 2188 | source, |
| 2189 | Transform3D::new(Vector3::ZERO, Quaternion::IDENTITY, scale), |
| 2190 | )) |
| 2191 | } |
| 2192 | |
| 2193 | fn add_axis_gizmo_mesh<API: ScriptAPI + ?Sized>( |
| 2194 | ctx: &mut ScriptContext<'_, API>, |
| 2195 | parent: NodeID, |
| 2196 | material: MaterialID, |
nothing calls this directly
no test coverage detected