Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to move clippingplanes with controller movements

6 REPLIES 6
Reply
Message 1 of 7
vredeye
366 Views, 6 Replies

how to move clippingplanes with controller movements

Hi

I am trying to move clipping planes with controller movements i.e the clipping plane should move when the controller moves ( along all axes ) , have tried out some ideas but didnt work so seeking help

6 REPLIES 6
Message 2 of 7

Hi, a clippingplane does not follow node hierarchy and or python constraints.

The only way is to write some python and update the clippingplane transformations and rotations in relation to what you want to.

You can use this example to attach your code to the main loop.

file:///C:/Program%20Files/Autodesk/VREDPro-17.1/doc/v2/examples/node.html?highlight=vraebase

 

best

Chris

 

 

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

Message 3 of 7
vredeye
in reply to: vredeye

ok so the clippingpane node if i link it to another node ( as a constraint ) wouldnt work ? the other node say is a simple box node. So when i make a constraint between the box and the controller node. I see i can move the box with controller.

 

I thought if i now link the box node with the clippingpane node , i should be able to move the clipping pane

 

So from your message it doesnt look like so 

Message 4 of 7

For what i know and tested, clippingplane nodes are not affected by parent and constraint transformations.

If i find something i can send you a python example to manage it.

 

Best
Chris

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

Message 5 of 7

Hi, this is an example to manage clipplanes position. Once setup you can use some constraints to move the refNode or directly manage the clipplane position

# This Script is an example to manage the position of clipplanes

# involved Nodes
clipPlane = vrNodeService.findNode("ClipPlane")
refNode = vrNodeService.findNode("Plane")
sphere = vrNodeService.findNode("Sphere")


# creation of test nodes if tare not presents
theRoot = vrScenegraphService.getRootNode()
if not refNode.isValid():
    refNode = vrGeometryService.createPlane(theRoot, QVector2D(2000,2000), resolutionX=10, resolutionY=10, color=QColor.fromRgbF(1.0, 0.0, 0.0))
    refNode.setTranslation(QVector3D(0,0,1000))
    refNode.setRotationAsEuler(QVector3D(0,90,0))
if not clipPlane.isValid():
    clipPlane = vrScenegraphService.createNode(vrScenegraphTypes.ClipPlaneNode, parent=theRoot, name='ClipPlane', forceUniqueName=True)
if not sphere.isValid():
    sphere = vrGeometryService.createSphere(clipPlane, 500, latres=50, longres=50, color=QColor.fromRgbF(1.0, 1.0, 1.0))
    sphere.setTranslation(QVector3D(1000,0,1000))

print(clipPlane)
print(refNode)
print(sphere)

# enable the clipPlane
clipPlane.setEnabled(True)

# Main update function
# customize for your needs
def clipPlanePosition():
    refNodePosition = refNode.getWorldTransform()
    clipPlane.setTransform(refNodePosition)    

# add to main loop
class clipPlanePositionUpdate(vrAEBase):
    def __init__(self):
        vrAEBase.__init__(self)
        self.addLoop()
    def recEvent(self, state):
        vrAEBase.recEvent(self, state)
    def loop(self):
        if self.isActive():
            clipPlanePosition()

clipPlanePosition_Update = clipPlanePositionUpdate()

# start and stop manager

# Use those to start the update on scene open
#clipPlanePosition_Update.setActive(True)
#clipPlanePosition_Update.setActive(False)

# use those to start and stop the update on user command
keyStartClipUpdate = vrKey(Key_D)
keyStartClipUpdate.connect("clipPlanePosition_Update.setActive(True);print('ClipPlaneUpdate Started')")
keyStopClipUpdate = vrKey(Key_E)
keyStopClipUpdate.connect("clipPlanePosition_Update.setActive(False);print('ClipPlaneUpdate Ended')")

 

To test it just paste the code in an empty scene

 

Best

Chris 

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

Message 6 of 7
vredeye
in reply to: vredeye

thanks i ll have a look

Message 7 of 7
vredeye
in reply to: vredeye

finally got the controller to control the movement of the clipplane. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report