WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-12-2017, 09:43 AM
engelskri3ger engelskri3ger is offline
Member
 
Join Date: May 2017
Posts: 1
Using 2 slider joints to move on a plane

Hey there,

I'm working on a project where I need to use a portalcrane where the mounted object is moved by grabbing it with the vizconnect grabber and the parts of the crane should move too. I want to use the built-in physics engine, so i tried to use multiple joints to connect the crane parts, but I didn't figure out yet, how I could use 2 slider joints to get the crane moving in the room.
Is there a way to do this? This is an example code I use for testing purposes:
Code:
# -----------------------------------------------------------------------
# Options

CYCLES_PER_SEC = 0.05  # Frames
viz.setMultiSample(4)  # Multisampling
viz.setOption('viz.max_frame_rate', 60)  # Avoid flickering
viz.vsync(viz.OFF)  # V-Sync
viz.collision(viz.ON)  # Viewport Collision
viz.phys.enable()  # Physics Simulation
viz.setOption('viz.model.cache', viz.CACHE_CLONE)
vizconnect.go(r'../vizconnect_files/keyboard.py') # Standard Vizconnect Keyboard Setting

# -----------------------------------------------------------------------
# Loading of Objects
grabber = vizconnect.getRawTool('grabber')
position = [5.0, 0, 0]
room = viz.add('lab.osgb')  # Room is loaded
room.collideMesh()  # Room gets Collision

box = vizshape.addBox(size=[12.8, 0.2, 0.2], pos=[0, 5.5, position[2]])
box.collideBox()
box_joint = viz.phys.addSliderJoint(box, None, pos=[0, 5.5, position[2]], axis0=(0, 0, 1))
box_joint.setAxisLimit(0, -6, 6)  # Limit sliding distance
box_joint.setAxisBounce(0, 0)  # Change end bounce properties

rope = vizshape.addBox(size=[0.075, 3, 0.075], pos=[position[0], 3.9, position[2]])
rope.collideBox()
rope_joint = viz.phys.addSliderJoint(rope, None, pos=[position[0], 3.9, position[2]], axis0=(1, 0, 0))
rope_joint.setAxisLimit(0, -12.8 / 2 - position[0],12.8 / 2 - position[0]) # Limit sliding distance
rope_joint.setAxisBounce(0, 0)  # Change end bounce properties

# rope_box_joint = viz.phys.addFixedJoint(box, rope)

grabber.addItems([rope])
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Slider Assistance new_horizon Vizard 3 05-16-2012 07:32 AM
Tiling a texture on a plane FreakyT Vizard 2 04-27-2011 05:34 PM
adding more than 1 action for avatar animation slider control yak Vizard 0 07-21-2009 11:22 AM
Vizmenu slider bug? Gladsomebeast Vizard 2 10-22-2008 08:05 PM
I need help with the Far Clip Plane... k_iwan Vizard 3 03-13-2007 04:54 AM


All times are GMT -7. The time now is 06:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC