Away3D learning notes-Object Location and movement

Source: Internet
Author: User

To understand the positional relationship between objects in Away3D, first create a coordinate system and three planes. The coordinate system has been encapsulated as a Trident class in Away3D and can be called directly:

var tri:Trident = new Trident(400, true);scene.addChild(tri);

The first parameter is the length of the coordinate axis, and the second parameter is the letter of the coordinate axis.

There are three Coordinate Planes. Here, the GridPlane class is better.

var p1:GridPlane = new GridPlane();p1.width = 800;p1.height = 800;p1.segmentsH = 2;p1.segmentsW = 2;p1.material = new WireframeMaterial(0xff0000);scene.addChild(p1);

Create two other planes by rotating them.

The center point of the ry created by Away3D is in its ry center. To change this point, you need to use the movePivot method. The movePivot method requires the coordinate parameter, which is relative to the center point of the ry, that is, local coordinates. Put a cube of 100*100*100 in the First quadrant, you can write:

cube.movePivot( -50, -50, -50);

Then the rotating axis of the object is changed to the three coordinate axes corresponding to the center.

In practical applications, moveForward and moveBackward are commonly used to control object positions. Their corresponding moving directions are:

MoveForward: Forward to the Z axis

MoveBackward: negative to the Z axis

MoveLeft: negative to the X axis

MoveRight: Forward to the X axis

MoveUp: forward to Y axis

MoveDown: Negative to Y axis

Three rotation functions are required:

Pitch: clockwise around the X axis

Yaw: clockwise around the Y axis

Roll: clockwise around the Z axis

Clockwise refers to looking at the direction of the specified axis. Since the nine functions can also contain negative parameters, there are actually only six functions that control the Six Degrees of Freedom of an object.

The advantage of using these functions is that they will adapt to the new local coordinate system with the object location.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.