instantreality forum
news: Welcome to the instantreality forums!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 17, 2018, 08:25:03 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Rotation on a set Route (Line)  (Read 1388 times)
vincee3
Newbie
*
Posts: 2


View Profile
« on: February 17, 2015, 02:08:18 pm »

Hello,

I have a problem. I made an Object, which shall move on a set Route.
Now the Object looks like a train and it does not rotate to the next Point.
I want to know, if it is possible, that it calculates its rotation.
I know I could just programm a rotation for the Route I build, but it should work on every Route without writing it again.

Logged
tfranke
Administrator
Jr. Member
*****
Posts: 89


View Profile
« Reply #1 on: February 18, 2015, 11:21:35 am »

Hey vincee3,

can you please post a code sample of your problem?

Cheers
Logged
vincee3
Newbie
*
Posts: 2


View Profile
« Reply #2 on: February 18, 2015, 01:24:57 pm »

Sorry I forgot that. Here is a easier version of what I think.



 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
    <Scene>
        <Viewpoint position ="0 12 0" orientation='1 0 0 -1.57079'/>
        <Transform DEF ='train'>
        <Shape>
            <Box size='0.25 0.5 1'/>
            <Appearance>
                <Material diffuseColor='1 0 0'/>
            </Appearance>
        </Shape>
        </Transform>
       
        <TimeSensor DEF='time' cycleInterval="8" loop='true' />
        <PositionInterpolator DEF='po_t'
        key = '0 0.090909 0.181818 0.272727 0.363636 0.454545 0.545454 0.636363 0.727272 0.818181 0.909090 1'
        keyValue = '0 0 0
                    1 0 0
                    1 0 1
                    2 0 2
                    2 0 4
                    1 0 4
                    0 0 4
                    -1 0 3
                    -2 0 2
                    -1 0 1
                    -1 0 0
                    0 0 0'/>
       
        <OrientationInterpolator DEF='or_t'
        key = '0 0.090909 0.181818 0.272727 0.363636 0.454545 0.545454 0.636363 0.727272 0.818181 0.909090 1'
        keyValue= '0 1 0 1.57079
                   0 1 0 1.57079
                   0 1 0 0
                   0 1 0 0.78539
                   0 1 0 0
                   0 1 0 -1.57079
                   0 1 0 -1.57079
                   0 1 0 3.92699
                   0 1 0 3.92699
                   0 1 0 2.35619
                   0 1 0 -3.14159
                   0 1 0 1.57079'/>
       
        <ROUTE fromNode='time' fromField='fraction_changed' toNode='po_t' toField='set_fraction'/>
        <ROUTE fromNode='time' fromField='fraction_changed' toNode='or_t' toField='set_fraction'/>
        <ROUTE fromNode='po_t' fromField='value_changed' toNode='train' toField='set_translation'/>
        <ROUTE fromNode='or_t' fromField='value_changed' toNode='train' toField='set_rotation'/>
    </Scene>
</X3D>

In this case I calculated all rotations by myself in the OrientationInterpolator. It was not that hard, because the Route was very easy. But I search for a solution, where I don't have to calculate every step. I'm looking for a solution of a codefragment, which calculates it for itself in x3d.

I hope you understand what I think of.

Greetings, vincee3
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines