For positioning the SquarePyramid mesh when applying a front flip

below is my code:
SquarePyramid: () => {
mesh.rotateZ(2);
// mesh.position.y = 2;
// mesh.position.x = 0;
//mesh.position.z = 0;
},
I cant able to have the proper position for front flip of square pyramid i tried some ways i can’t able to fix. Guys if u know please give me the solution.

It’s not clear what you’re trying to do, and i hope you know rotateZ takes in radians (there’s 2*PI radians in 360°)

2 Likes

when i used like this
SquarePyramid: () => {
mesh.rotateZ(2*Math.PI);
},
it is not moving anything

because that’s moving you around 360 back to your initial orientation. You should use ([deg]/180)*PI instead. [Deg] stands for whatever degree you’d want to convert to radians.

2 Likes

public flipFront(mesh: THREE.Mesh): void {
this.handleMeshTransformation(mesh, {
HalfCylinder: () => {
mesh.rotateZ(ActionConfiguration.offesetflipfront);
mesh.position.y += ActionConfiguration.offsetHalfCylinderfrontBack;
mesh.position.x -= ActionConfiguration.offsetCurvedCubeHalfCylinder;
},
Prism: () => {
mesh.rotateZ(ActionConfiguration.offesetflipfront);
mesh.position.y += ActionConfiguration.offesetPrismCurveCube;
mesh.position.x -=
ActionConfiguration.offsetrotateCurvedCubeZandFlipfrontbackPrismX;
},
SquarePyramid: () => {
mesh.rotateZ((45 / 180) * Math.PI);
},
Cone: () => {
mesh.rotateZ(ActionConfiguration.offesetflipfront);
mesh.position.x += ActionConfiguration.offsetHalfcylinderConeCylinder;
},
Cylinder: () => {
mesh.rotateZ(ActionConfiguration.offesetflipfront);
mesh.position.x += ActionConfiguration.offsetHalfcylinderConeCylinder;
},
HemiSphere: () => {
mesh.position.y += ActionConfiguration.offsetHemisphere;
mesh.rotateY(ActionConfiguration.offsetSquarePyaramidHemisphere);
}
});
}
actually this is my code for front flip all the shape is working properly except squarepyramid
it always landed by one of the vertex instead of landed by edge

the only what i want to know is why it is landed by vertex

This topic was automatically closed after 30 days. New replies are no longer allowed.