But while using this code I am facing error my object is not moving to the destination point instead my button itself is moving to the destination where my object is to be placed please help me out of this
var cube1, cube2;
beScript.onStart = function () {
console.log("Hello, I'm executed at experience start");
// Debug: List available methods on 'this'
console.log(Object.keys(this));
// Try to retrieve references to cube1 and cube2
try {
cube1 = this.getActor ? this.getActor("Hi") : null; // Adjust according to actual method
cube2 = this.getActor ? this.getActor("3D Actor") : null; // Adjust according to actual method
if (!cube1) {
console.error("Unable to find cube1. Make sure the name is correct and the method used is correct.");
} else {
console.log("cube1 initialized:", cube1);
}
if (!cube2) {
console.error("Unable to find cube2. Make sure the name is correct and the method used is correct.");
} else {
console.log("cube2 initialized:", cube2);
}
} catch (error) {
console.error("Error retrieving cubes: ", error);
}
};
beScript.onUIClick = function (iEvent) {
console.log("Button clicked"); // Debug: Log button click
if (cube1 && cube2) {
try {
cube1.setPosition(new DSMath.Vector3D(0, -633.021, 952.071));
cube2.setPosition(new DSMath.Vector3D(985.719, 0, 1083.843));
console.log("Cubes placed successfully.");
} catch (error) {
console.error("Error placing cubes: ", error);
}
} else {
console.error("Cubes not initialized properly.");
}
};
beScript.onClickablePress = function (e) {
console.log("Clickable area pressed");
// Place cube1 and cube2 at specific positions
if (cube1 && cube2) {
try {
cube1.setPosition(new DSMath.Vector3D(0, -633.021, 952.071));
cube2.setPosition(new DSMath.Vector3D(985.719, 0, 1083.843));
console.log("Cubes placed successfully.");
} catch (error) {
console.error("Error placing cubes: ", error);
}
} else {
console.error("Cubes not initialized properly.");
}
};
beScript.onStop = function () {
console.log("Goodbye, I'm executed at experience end");
};
