So engine examples need to create a pc.Application instance and setup a scene. That usually involves creating a camera, a number of objects with models/materials etc.
In editor most of that happens automatically/visually. In the case of the example to transfer in editor you will have to:
The house.glb imported to the editor as asset type “binary” but I changed it to “container” in code. I’m not sure if that is recommended but it worked.
Hey @Leonidas and @yaustar and @Kulodo133 , Thanks for the help. I figured it out . What’s happening is the whole mesh is deforming. What changes should i make so that the mesh deforms in along one axis(say z).
In below project, I modified a bit and made it deform on y axis , but I am not able to change the axis itself from y to z-axis or x-axis . I wanted a deformation such that on slider move mesh should bulge out or in https://playcanvas.com/editor/scene/1420045
I think you can easily do that by changing line 94 in your script to either one:
// deforms in X
this.positions[index] = elevation;
// or deforms in Y
this.positions[index + 1] = elevation;
// or deforms in Z
this.positions[index + 2] = elevation;
Also, can you please help me with how to deform larger area. I am changing the position and scale of deform target entity but the deformation is happening in that particular area of mesh. And I can’t understand why I’m getting pointy heads compared to your demo on mesh generation.
Most probably the reason for “pointy heads” is because your positions array is larger than the amount of vertices you have in your mesh, making it so that the last part of your array is filled with zeros. Zeros are valid vertex coordinates pc.Vec3(0, 0, 0), so your mesh vertices are just placed there.
How should I control the position array. Its assigned by the source positions of the meshes. I tried it with different models with different meshes. All I am getting is same pointy deformation where I am not able to specify the area for deformation too.