Crystal Space
Welcome, Guest. Please login or register.
July 26, 2014, 06:41:28 pm

Login with username, password and session length
Search:     Advanced search
9005 Posts in 2043 Topics by 8237 Members
Latest Member: Mikealexander
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  How to use portal to "go back"?
« previous next »
Pages: [1] Print
Author Topic: How to use portal to "go back"?  (Read 3114 times)
Jr. Member
**
Posts: 81


View Profile Email
« on: November 01, 2007, 06:09:28 am »

    I followed the "XMLWorld Tutorial" to use XML to build a world map. In the tutorial it only told me how to build a portal from room to room2, but it didn't tell me how to go back(from room2 to room). I tried a lot of methods, but it didn't work well. Can you give me some suggestion to deal with the problem?
    Thank you very much for your help!!

The XML code is followed.
<?xml version='1.0' encoding='UTF-8'?>   
     <world>
         <textures>
             <texture name="oldmetal">
                 <file>/lib/stdtex/oldmetal.jpg</file>
             </texture>
         </textures>
         
         <shaders>
             <shader>
                 <file>/shader/std_lighting_detail.xml</file>
             </shader>
         </shaders>
         
         <materials>
             <material name="oldmetal">
                 <texture>oldmetal</texture>
                 <shader type="standard">std_lighting_detail</shader>
                 <shadervar name="tex detail" type="texture">oldmetal</shadervar>
                 <shadervar name="detail texture scale" type="vector2">10,10</shadervar>
             </material>
         </materials>
         
         <sounds>
             <sound name="tada.wav">
                 <file>/lib/std/tada.wav</file>
             </sound>
        </sounds>

        <library path="/lib/std" file="library" />
       
        <plugins>
             <plugin name="thing">crystalspace.mesh.loader.thing</plugin>
             <plugin name="thingFact">crystalspace.mesh.loader.factory.thing</plugin>
        </plugins>
       
      <meshfact name="walls">
         <plugin>thingFact</plugin>
         <zfill />
      <params>
        <v x="-10" y="-1" z="10"/> <v x="10" y="-1" z="10"/>
        <v x="-10" y="-1" z="-10"/> <v x="10" y="-1" z="-10"/>
        <v x="-10" y="4" z="10"/> <v x="10" y="4" z="10"/>
        <v x="-10" y="4" z="-10"/> <v x="10" y="4" z="-10"/>
        <material>old_metal</material>
        <texlen>4</texlen>
        <p name="up">
          <v>6</v> <v>7</v> <v>5</v> <v>4</v>
        </p>
        <p name="down">
          <v>3</v> <v>2</v> <v>0</v> <v>1</v>
        </p>
        <p name="back">
          <v>7</v> <v>6</v> <v>2</v> <v>3</v>
        </p>
        <p name="front">
          <v>4</v> <v>5</v> <v>1</v> <v>0</v>
        </p>
        <p name="left">
          <v>6</v> <v>4</v> <v>0</v> <v>2</v>
        </p>
        <p name="right">
          <v>5</v> <v>7</v> <v>3</v> <v>1</v>
        </p>
      </params>
    </meshfact>

    <start>
         <sector>room</sector>
         <position x="0" y="0" z="0" />
     </start>

     <sector name="room">
         <meshobj name="walls">
             <plugin>thing</plugin>
             <params>
                  <factory>walls</factory>
             </params>
         </meshobj>
         
        <portals>
         <portal name="port1">
             <v x="9.7" y="1" z="1" />
             <v x="9.7" y="1" z="0" />
             <v x="9.7" y="-1" z="0" />
             <v x="9.7" y="-1" z="1" />
             <wv x="1" y="0" z="0" />
             <ww x="-1" y="0" z="0" />
             <sector>room2</sector>
             <float />
         </portal>
         <priority>object</priority>
     </portals>

         <light name="light1">
             <center x="0" y="0" z="0" />
             <radius>20</radius>
             <color red="2" green="2" blue="2" />
         </light>
     </sector>

    <sector name="room2">
         <meshobj name="walls">
             <plugin>thing</plugin>
             <params>
                  <factory>walls</factory>
             </params>
             <move>
                 <v x="20" y="0" z="0" />
             </move>
         </meshobj>
     
         <light name="light1">
             <center x="20" y="0" z="0" />
             <radius>20</radius>
             <color red="2" green="2" blue="2" />
             <dynamic />
         </light>
     </sector>

     </world>
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: November 01, 2007, 06:43:16 am »

To make a portal back you need to make another portal that goes in the other direction. A portal is always one-way.

Greetings,
Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #2 on: November 02, 2007, 06:13:28 am »

To make a portal back you need to make another portal that goes in the other direction. A portal is always one-way.

Greetings,

     I tried to make a portal in room2.
     I duplicated "port1" which set in room and renamed it with "port2", then I made port2 to point to room, but it could not work. Did any difference between port1 and port2 in  setting the portal's dimensions ?!
 
the code is followed:
<?xml version='1.0' encoding='UTF-8'?>   
     <world>
         <textures>
             <texture name="oldmetal">
                 <file>/lib/stdtex/oldmetal.jpg</file>
             </texture>
         </textures>
         
         <shaders>
             <shader>
                 <file>/shader/std_lighting_detail.xml</file>
             </shader>
         </shaders>
         
         <materials>
             <material name="oldmetal">
                 <texture>oldmetal</texture>
                 <shader type="standard">std_lighting_detail</shader>
                 <shadervar name="tex detail" type="texture">oldmetal</shadervar>
                 <shadervar name="detail texture scale" type="vector2">10,10</shadervar>
             </material>
         </materials>
         
         <sounds>
             <sound name="tada.wav">
                 <file>/lib/std/tada.wav</file>
             </sound>
        </sounds>

        <library path="/lib/std" file="library" />
       
        <plugins>
             <plugin name="thing">crystalspace.mesh.loader.thing</plugin>
             <plugin name="thingFact">crystalspace.mesh.loader.factory.thing</plugin>
        </plugins>
       
      <meshfact name="walls">
         <plugin>thingFact</plugin>
         <zfill />
      <params>
        <v x="-10" y="-1" z="10"/> <v x="10" y="-1" z="10"/>
        <v x="-10" y="-1" z="-10"/> <v x="10" y="-1" z="-10"/>
        <v x="-10" y="4" z="10"/> <v x="10" y="4" z="10"/>
        <v x="-10" y="4" z="-10"/> <v x="10" y="4" z="-10"/>
        <material>old_metal</material>
        <texlen>4</texlen>
        <p name="up">
          <v>6</v> <v>7</v> <v>5</v> <v>4</v>
        </p>
        <p name="down">
          <v>3</v> <v>2</v> <v>0</v> <v>1</v>
        </p>
        <p name="back">
          <v>7</v> <v>6</v> <v>2</v> <v>3</v>
        </p>
        <p name="front">
          <v>4</v> <v>5</v> <v>1</v> <v>0</v>
        </p>
        <p name="left">
          <v>6</v> <v>4</v> <v>0</v> <v>2</v>
        </p>
        <p name="right">
          <v>5</v> <v>7</v> <v>3</v> <v>1</v>
        </p>
      </params>
    </meshfact>

    <start>
         <sector>room</sector>
         <position x="0" y="0" z="0" />
     </start>

     <sector name="room">
         <meshobj name="walls">
             <plugin>thing</plugin>
             <params>
                  <factory>walls</factory>
             </params>
         </meshobj>
         
        <portals>
         <portal name="port1">
             <v x="9.7" y="1" z="1" />
             <v x="9.7" y="1" z="0" />
             <v x="9.7" y="-1" z="0" />
             <v x="9.7" y="-1" z="1" />
             <wv x="1" y="0" z="0" />
             <ww x="-1" y="0" z="0" />
             <sector>room2</sector>
             <float />
         </portal>
         <priority>object</priority>
     </portals>


         <light name="light1">
             <center x="0" y="0" z="0" />
             <radius>20</radius>
             <color red="2" green="2" blue="2" />
         </light>
     </sector>

    <sector name="room2">
         <meshobj name="walls">
             <plugin>thing</plugin>
             <params>
                  <factory>walls</factory>
             </params>
             <move>
                 <v x="20" y="0" z="0" />
             </move>
         </meshobj>
         
     <portals>
         <portal name="port2">
             <v x="9.7" y="1" z="1" />
             <v x="9.7" y="1" z="0" />
             <v x="9.7" y="-1" z="0" />
             <v x="9.7" y="-1" z="1" />
             <wv x="1" y="0" z="0" />
             <ww x="-1" y="0" z="0" />
             <sector>room</sector>
             <float />
         </portal>
         <priority>object</priority>
     </portals>
     

         <light name="light1">
             <center x="20" y="0" z="0" />
             <radius>20</radius>
             <color red="2" green="2" blue="2" />
             <dynamic />
         </light>
     </sector>


     </world>

Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: November 02, 2007, 06:17:14 am »

Yes, you need to reverse the order of the vertices in the other portal.

Greetings,
Logged
SkyFox
Newbie
*
Posts: 47


View Profile Email
« Reply #4 on: November 05, 2007, 08:32:38 am »

The xml code never seems to contain any information about the position in the target sector, that the portal leads to. How does an application know where to warp to in the target sector?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #5 on: November 05, 2007, 08:41:43 am »

Unless you use space warping the portal arrives at the same coordinate as where it starts.

Greetings,
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.303 seconds with 15 queries.