Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






Change magnetic property in the example
#1
Just popping in
Just popping in


See User information
Hi

I am wondering how would I turn on/turn off the MagneticSurface property every 5 seconds in the example?

<Scene>
  <
DynamicTransform DEF="D" angularMomentum="0.0 0.0 0.0">
      <
Shape>
        <
Appearance>
          <
Material transparency="1"/>
          <
MagneticSurface  staticFriction='0.0' dynamicFriction='0.0' 
                            
stiffness='0.4' damping='0.4' 
                            
snapDistance='0.01' />
        </
Appearance>      
        <
Sphere radius='0.125' />
      </
Shape>
      <
Shape>
        <
Appearance>
          <
Material DEF='M' />
          <
ImageTexture url="1.png"/>
          <
SmoothSurface stiffness="1.0" />
        </
Appearance>      
        <
Box size="0.3 0.3 0.1"/>
      </
Shape>
  </
DynamicTransform>
</
Scene>

Posted on: 2016/3/2 21:30
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Change magnetic property in the example
#2
Webmaster
Webmaster


See User information
Hello and welcome to the h3d forum.

You will have to use the python capabilities in H3D to achieve this, mostly because MagneticSurface does not have an enabled field. If it did have an enabled field you could just setup a booleansequencer as in the example examples/All/BooleanSequencer.x3d

The best way is probably to just create a specialised field that takes an SFBool as input and outputs an SFNode. Something like this (code not checked for syntax errors and neither completed):
class SurfaceEnablerTypedFieldSFNodeSFBool ) ):
  
def updateselfevent ):
    if 
event.getValue():
      
magnetic_surface_node createX3DNodeFromString("""<MagneticSurface  staticFriction='0.0' dynamicFriction='0.0'  
                            stiffness='0.4' damping='0.4'  
                            snapDistance='0.01' />"""
)[0]
      return 
magnetic_surface_node 
    
return None


The input boolean would come from a setup as in the BooleanSequencer.x3d example I referred to.

Posted on: 2016/3/3 8:04
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Change magnetic property in the example
#3
Just popping in
Just popping in


See User information
thanks.

Posted on: 2016/3/3 18:48
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