Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds

Forum Index


Board index » All Posts




Re: Remove Nodes from a Scene.
#1
Webmaster
Webmaster


Hello,

This is terribly embarrassing but I have not seen this post. My deepest apologies I thought I had notifications on, will see if I can turn it on again.

Here is a modification of your python script which you can play with.

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

class TokenPickup (TypedField(SFVec3fSFBool)):
  
def __init__(selfdefault_positiontarget_position):
    
TypedField(SFVec3fSFBool).__init__(self)
    
self.target_position target_position
    self
.default_position default_position
    
# Do this to set the initial value of the field. If you do not do this then PickToken.getValue() will return 0,0,0. 
    
self.setValuedefault_position )

  
def update(self,event):

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

    #get whether it was touched or not 
    #shapetouched = shape.istouched.getValue();
    
event.getValue();
    if(
== True):
      return 
self.target_position
    
return self.default_position # To get rid of any warnings about not returning a value in all cases. If you skip this then I think that 0,0,0 will be returned.
PickToken =TokenPickupVec3f(0.290.10), Vec3f(0.290.180))

Posted on: Today 10:43
Top


Re: Capture force exerted by user
#2
Not too shy to talk
Not too shy to talk


Thank you Markus, will check it out.

Posted on: 10/17 17:11
Top


Re: Capture force exerted by user
#3
Webmaster
Webmaster


Hello,

You could take a look at the tutorials section in the wiki.
http://www.h3dapi.org/modules/mediawiki/index.php/H3DAPI_Tutorials
I was thinking about the light a bomb with a match tutorial.
From there we also (apparently) have a link that I forgot about to an external site with tutorials. On that site they do have a "block maze" tutorial. So that is probably the closest to a simple game you could find.

https://sites.google.com/site/h3dtutorials/
https://sites.google.com/site/h3dtutorials/blockmaze

Posted on: 10/17 10:38
Top


Re: Capture force exerted by user
#4
Not too shy to talk
Not too shy to talk


Thanks for your help Markus, I will try what you suggested.

I have another question.
I am writing a simple game so that when the user goes along a path they can collect tokens similar to an endless runner game. Do you have any suggestions on how I could go about this, any examples that I could look at?

I so far created 1 scene with one straight path it has tokens on the path however when the user touches the token only the first one disappears.

Posted on: 10/16 23:03
Top


Re: Capture force exerted by user
#5
Webmaster
Webmaster


Hello,

Exactly what do you mean with "the force the user exerts"? I assume this is not the same force as the force that is rendered on the haptics device. If that is what you want then the DeviceLog class might be useful to you.

If you set it up so that you only have passive forces which reacts to the users input then you could probably fake a direct mapping. Such as using a SpringEffect to measure the force the user inputs. You still would have to account for things like gravity perhaps to get a better measurement though.

Posted on: 10/12 9:44
Top


Capture force exerted by user
#6
Not too shy to talk
Not too shy to talk


Good Day,

Is there any way to capture the force the user exerts when using the haptic device...is there any function or node that stores the force the user exerts when using the haptic device."Phantom OMni"

Posted on: 10/11 21:27
Top


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


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
Top


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


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
Top


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


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
Top


Re: Using Leap Motion with H3D
#10
Just can't stay away
Just can't stay away


there are many ways to monitor the h3d frame rate. First in h3dviewer, you can press F8 to bring up a ui which displays the frame rates.

Or you can use some other gaming fps monitor tools such as fraps to monitor the fps of the application. Since h3d is a rendering program like a game, you will also get frame rate data through those tools.

If your frame rate is good enough, the lagging issue should not be that serious as you described.

Posted on: 8/17 10:04
Top



TopTop
(1) 2 3 4 ... 964 »






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