Hello to everyone,
I try to move a Sphere on a Plane. I use the mouse’s “x offset” from the center of the screen to rotate the Sphere. Then, when the user “presses the ctrl button and clicks” a constant force is applied to the Sphere.
The code used is the following:
private function onMouseClick(event : MouseEvent) : void {
force = sphere.forwardVector;
force.negate();
force.scaleBy(BALL_FORCE);
if (event.ctrlKey) {
sphereRigidBody.applyCentralForce(force);
}
trace("force.x: " + force.x + ", force.y: " + force.y + ", force.z: " + force.z);
}
(BALL_FORCE is a Number declared as “private static const”)
And the traces received are:
force.x: 0, force.y: 0, force.z: -700
force.x: 0, force.y: 0, force.z: -700
force.x: 0, force.y: -41.85575713419593, force.z: 698.7475192047004
force.x: 0, force.y: 699.308698847882, force.z: 31.10214969551242
force.x: 0, force.y: 698.5301337461049, force.z: 45.339301369218916
force.x: 0, force.y: 694.9358876001116, force.z: 84.0482725904877
As you can see, after 2 or 3 loops the “front” vector changes direction as far as its height (y-axis) is concerned while the “force” applied remains the same (or at least, I think it does).
So, I would like to ask how does the “applyCentralForce” method affects the “front” property of an AWPRigidBody?
Thank you very much.