Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






Remove Nodes from a Scene.
#1
Not too shy to talk
Not too shy to talk


See User information
Good Day,

I am trying to make nodes disappear when the touch sensor is activated and i am having an issue as it just does not work. Below is the x3d script

<TouchSensor DEF='MS' description ='Touch this' enabled = 'true' />

<Transform DEF ="position" translation= "-.1 .01 .0"
rotation="-0.261806 0.363184 0.894178 3.087060" >
<Shape >
<Box DEF="PickUp" size=".01 .01 .01"/> <Appearance>
<Material DEF ='MAT' diffuseColor="0.5 0 0.5" transparency='0'/>
<FrictionalSurface stiffness="0.6"/>
</Appearance>
</Shape>
</Transform>

<PythonScript DEF ="PT" url="C:\Users\dauguste\Desktop\Annancy'sRaceLevel1\PickUpBlocks.py"/>
<ROUTE fromNode='MS' fromField='isOver' toNode='PT' toField='PickToken'/>
<ROUTE fromNode='PT' fromField='PickToken' toNode='position' toField='translation'/>

this the python script

from H3DInterface import *

class Disappear(TypedField(SFVec3f, SFBool)) :
translation = "1 1 1";
def update(self,event) :
a = event.getValue();
if(a==True) :
return self.translation = "0 0 0";

PickToken = Disappear()


any assistance will be greatly appreciated.


Posted on: 10/4 23:00
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove Nodes from a Scene.
#2
Not too shy to talk
Not too shy to talk


See User information
Hi Everyone,

So I got the node to change position however, when i load the scene in x3d now instead of the node staying at its original location it is going to the default 0 0 0 and then when the mouse is over it... it changes the position. This is not what i want. I want to stay at the position i set it at originally and when the mouse is over it move to a new location.
Below is the working script let me know what i can change plzzzzzzz.. lol thanks.


<Scene>
<TouchSensor DEF='MS' description ='Touch this' enabled = 'true' />

<Transform DEF ="position" translation= "-.1 .01 .0"
rotation="-0.261806 0.363184 0.894178 3.087060" >
<Shape DEF = "Token" >
<Box DEF="PickUp" size=".20 .20 .20"/> <Appearance>
<Material DEF ='MAT' diffuseColor="0.5 0 0.5" transparency='0'/>
<FrictionalSurface stiffness="0.6"/>
</Appearance>
</Shape>
</Transform>

<PythonScript DEF ="PT" url="TestScript.py">
<Transform USE= "position" containerField = "references"/>
<Shape USE = "Token" containerField ="references"/>
</PythonScript>
<ROUTE fromNode='MS' fromField='isOver' toNode='PT' toField='PickToken'/>
<ROUTE fromNode='PT' fromField='PickToken' toNode='position' toField='translation'/>
</Scene>


#Test Script
from H3DInterface import *
#import TestDisappear
import sys

class TokenPickup (TypedField(SFVec3f, SFBool)):
def update(self,event):

#trans = references.getValue()[0]
#shape = references.getValue()[1]

#get whether it was touched or not
#shapetouched = shape.istouched.getValue();
a = event.getValue();
if(a == True):
return Vec3f(0.29, 0.18, 0);
PickToken =TokenPickup()

Posted on: 10/5 18:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove Nodes from a Scene.
#3
Not too shy to talk
Not too shy to talk


See User information
Hi Guys,

Any help on the above will be greatly appreciated. I have gotten no where with it. The node keeps going to the origin when the scene is loaded when I have a set translation for it "-.1 .01 .0" . It still defaults to the origin. See last code above.

Regards,
Darcelle

Posted on: 10/9 22:55
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





(C) 2012 SenseGraphics AB    ---    Powered by XOOPS