How does one automatically roam or walk in a specified path in the VRML/X3D environment? And if the control only goes through?

Source: Internet
Author: User

How does one automatically roam or walk in a specified path in the VRML/X3D environment? And if the control only goes through?

I checked a lot of information today and concluded that this is a relatively simple solution.

It mainly uses timesensor, touchsensor, positioninterpolator, and orientationinterpolator.

Example:

Def PI positioninterpolator {

Key [0

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

]

KeyValue [

9 1.5 2,

9 1.5 4,

20 1.5 15,

22 1.5 15,

23 1.5 16,

42 1.5 16,

43 1.5 17,

43 1.5 31,

42 1.5 32,

42 1.5 38,

41 1.5 39,

]

}

Def oi orientationinterpolator {

Key [0 0.05 0.25 0.3 0.35 0.55 0.6 0.75 0.8 0.95 1]

KeyValue [

0 1 0 3.14,

0 1 0 4,

0 1 0-1.57,

0 1 0-1.57,

0 1 0-1.57,

0 1 0-2.8,

0 1 0 3.14,

0 1 0 3.14,

0 1 0 3.14,

0 1 0 3.14,

0 1 0 3.14]

}

Def ts timesensor {

Cycleinterval 33

Loop false

}

Def TCT touchsensor {}

Route TCT. touchtime to ts. starttime

Route ts. fraction_changed to Pi. set_fraction

# Route pi. value_changed to tr. set_translation

Route pi. value_changed to CVP. set_position

Route ts. fraction_changed to Oi. set_fraction

Route Oi. value_changed to CVP. set_orientation

When the loop is false, you need to start timesensor by yourself. At this time, touchsensor is used to transmit the starttime of ts for start.

In this way, an animation (that is, a path walk) is triggered every time an object is clicked in a scene ).

If you set the loop to true, you do not need touchsensor to start it. It starts automatically and keeps repeating.

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.