lmx_xml
December 13, 2018, 9:49am
#1
If I create a box, and I want to reshape it to be longer or width more , how can I perform in code without scale it ?
And I wish to get the index of the point and set ( x,y,z ) to it like three.js.
if (dragging && currentIndex !== null) {
setRaycaster(event);
raycaster.ray.intersectPlane(plane, planePoint);
geometry.attributes.position.setXYZ(currentIndex, planePoint.x, planePoint.y, planePoint.z);
geometry.attributes.position.needsUpdate = true;
}
any way to code it ? @will
yaustar
December 13, 2018, 1:26pm
#2
Not my area but the voxel canvas project here creates meshes in realtime. You may be able to find some clues/ideas here on how to modify vertices there: https://playcanvas.com/project/448005/overview/voxelcanvas
will
December 15, 2018, 5:32am
#3
Does this help?
https://developer.playcanvas.com/en/tutorials/terrain-generation/
This uses the pc.createMesh function.
This is a utility function that creates a pc.Mesh structure for you (that essentially contains all the vertex data).
The code for that function is here:
* // Create a new mesh supplying optional parameters using object literal notation
* var mesh = pc.createMesh(
* graphicsDevice,
* positions,
* {
* normals: treeNormals,
* uvs: treeUvs,
* indices: treeIndices
* });
*/
pc.createMesh = function (device, positions, opts) {
// Check the supplied options and provide defaults for unspecified ones
var normals = opts && opts.normals !== undefined ? opts.normals : null;
var tangents = opts && opts.tangents !== undefined ? opts.tangents : null;
var colors = opts && opts.colors !== undefined ? opts.colors : null;
var uvs = opts && opts.uvs !== undefined ? opts.uvs : null;
var uvs1 = opts && opts.uvs1 !== undefined ? opts.uvs1 : null;
var indices = opts && opts.indices !== undefined ? opts.indices : null;
var blendIndices = opts && opts.blendIndices !== undefined ? opts.blendIndices : null;
var blendWeights = opts && opts.blendWeights !== undefined ? opts.blendWeights : null;
You can create/edit any mesh in a similar fashion.
yes, I have found it , and render a new mesh every time. this did help me! thanks.