hhoria
September 1, 2021, 12:12pm
#1
Hi everyone,
I’m trying to generate a PieSlice, similar on how 3ds max is doing for tube or cylinder with the slice option( slice from x1 degrees to x2 degrees)
Any idea where i should start looking into?
Hi @hhoria ,
Is this for a 2D UI element use-case?
hhoria
September 1, 2021, 12:16pm
#3
Hi, it would be 3d, I need it to visually show the measurement of angles between 2 surfaces
any screenshot of what you’re after?
It sounds like you could draw lines?
hhoria
September 1, 2021, 1:46pm
#5
This is a slice from 0 to 90 degrees
Something similar, it can be purely flat, but I’d need it in 3d world space
hhoria
September 1, 2021, 1:56pm
#6
It doesn’t necessarily need to be solid fill, it can be just the contour as well
You’d use mesh API and generate triangles as needed
https://developer.playcanvas.com/en/api/pc.Mesh.html
something along these lines (this generates 2D plane and later deforms it)
http://playcanvas.github.io/#/graphics/mesh-generation
similar example on how the engine generates cylinder primitive:
* is generated into the vertex buffer of the cylinder's mesh.
* @param {GraphicsDevice} device - The graphics device used to manage the mesh.
* @param {object} [opts] - An object that specifies optional inputs for the function as follows:
* @param {number} [opts.radius] - The radius of the tube forming the body of the cylinder (defaults to 0.5).
* @param {number} [opts.height] - The length of the body of the cylinder (defaults to 1.0).
* @param {number} [opts.heightSegments] - The number of divisions along the length of the cylinder (defaults to 5).
* @param {number} [opts.capSegments] - The number of divisions around the tubular body of the cylinder (defaults to 20).
* @param {boolean} [opts.calculateTangents] - Generate tangent information (defaults to false).
* @returns {Mesh} A new cylinder-shaped mesh.
*/
function createCylinder(device, opts) {
// #if _DEBUG
if (opts && opts.hasOwnProperty('baseRadius') && !opts.hasOwnProperty('radius')) {
console.warn('DEPRECATED: "baseRadius" in arguments, use "radius" instead');
}
// #endif
// Check the supplied options and provide defaults for unspecified ones
var radius = opts && (opts.radius || opts.baseRadius);
radius = radius !== undefined ? radius : 0.5;
var height = opts && opts.height !== undefined ? opts.height : 1.0;
1 Like