//#OsgVortex Header v1.0 // Specifies windows attributes Viewer { Window { Title "OsgVortex Prismatic Joint example (VRlab)" Origin [1 1] // position of window Size [1280 1024] // size of window FullScreen 1 // Start in full screen mode } } OptimizeScene 1 // Should the whole graphical scene be optimized? Let it be 0 for now. World { StepLength 0.01 // Specifies the step length for the simulation loop. SafeTime 0 AutoDisable 0 Gravity [0 0 -9.81] // Gravity constant // IntegrationModel "StableStepper" LCPSettings { MaxIterations 100 } } #define ENVIRONMENT_MATERIAL 0 #define DEFAULT_MATERIAL 1 Material { ID "env default" Tuple [ENVIRONMENT_MATERIAL DEFAULT_MATERIAL] Friction 4 Restitution 0.2 FrictionModel "ScaledBox" } Material { ID "def def" Tuple [DEFAULT_MATERIAL DEFAULT_MATERIAL] Friction 0.1 Restitution 0.3 //FrictionModel "ScaledBox" } Object { ID "cone1" Size [0.1 0.2] Position [0 0 3] Orientation [0 0 45] Dynamic 1 VisualAttributes { Light { } Geometry { Primitive "cone" } } } Object { ID "floor" Size [30 30] Position [0 0 0] Orientation [0 0 0] Dynamic 0 VisualAttributes { Geometry { Primitive "plane" } } PhysicalAttributes { Geometry { Primitive "plane" } Material ENVIRONMENT_MATERIAL } } pillow_size { radius 0.1 height 2 } pillow_pos { x 1 y 1 z pillow_size.height/2 } // =================== // Pillows // =================== Object { ID "pillow1" Size [pillow_size.radius pillow_size.height ] Position [-pillow_pos.x -pillow_pos.y pillow_pos.z ] Dynamic 0 VisualAttributes { Geometry { Primitive "cylinder" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "cylinder" } } } Object { ID "pillow2" Size [pillow_size.radius pillow_size.height ] Position [pillow_pos.x -pillow_pos.y pillow_pos.z ] Dynamic 0 VisualAttributes { Geometry { Primitive "cylinder" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "cylinder" } } } Object { ID "pillow3" Size [pillow_size.radius pillow_size.height ] Position [pillow_pos.x pillow_pos.y pillow_pos.z ] Dynamic 0 VisualAttributes { Geometry { Primitive "cylinder" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "cylinder" } } } Object { ID "pillow4" Size [pillow_size.radius pillow_size.height ] Position [-pillow_pos.x pillow_pos.y pillow_pos.z ] Dynamic 0 VisualAttributes { Geometry { Primitive "cylinder" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "cylinder" } } } // =================== // Holders of the springs // =================== holder_size 0.1 holder_pos { x pillow_pos.x y pillow_pos.y z pillow_size.height+holder_size } #define HOLDER_POS1 [-holder_pos.x -holder_pos.y holder_pos.z ] #define HOLDER_POS2 [holder_pos.x -holder_pos.y holder_pos.z ] #define HOLDER_POS3 [holder_pos.x holder_pos.y holder_pos.z ] #define HOLDER_POS4 [-holder_pos.x holder_pos.y holder_pos.z ] holder_dynamic 0 Object { ID "holder1" Size [holder_size ] Position HOLDER_POS1 Dynamic holder_dynamic VisualAttributes { Geometry { Primitive "sphere" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "sphere" } } } Object { ID "holder2" Size [holder_size ] Position HOLDER_POS2 Dynamic holder_dynamic VisualAttributes { Geometry { Primitive "sphere" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "sphere" } } } Object { ID "holder3" Size [holder_size ] Position HOLDER_POS3 Dynamic holder_dynamic VisualAttributes { Geometry { Primitive "sphere" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "sphere" } } } Object { ID "holder4" Size [holder_size ] Position HOLDER_POS4 Dynamic holder_dynamic VisualAttributes { Geometry { Primitive "sphere" } } PhysicalAttributes { Material DEFAULT_MATERIAL Geometry { Primitive "sphere" } } } basket_size { thickness 0.1 x 1 y 1 z 0.6 } basket_pos { x 0 y 0 z pillow_size.height/2 } Object { ID "basket_wall1" Size [basket_size.thickness basket_size.y basket_size.z ] Position [-basket_pos.x-basket_size.x/2+basket_size.thickness/2 basket_pos.y basket_size.z/2 ] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Object { ID "basket_wall2" Size [basket_size.thickness basket_size.y basket_size.z ] Position [basket_pos.x+basket_size.x/2-basket_size.thickness/2 basket_pos.y basket_size.z/2 ] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Object { ID "basket_wall3" Size [basket_size.x basket_size.thickness basket_size.z ] Position [basket_pos.x basket_pos.y+basket_size.y/2+basket_size.thickness/2 basket_size.z/2 ] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Object { ID "basket_wall4" Size [basket_size.x basket_size.thickness basket_size.z ] Position [basket_pos.x -basket_pos.y-basket_size.y/2-basket_size.thickness/2 basket_size.z/2 ] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Object { ID "basket_floor" Size [basket_size.x basket_size.y basket_size.thickness ] Position [basket_pos.x basket_pos.y basket_size.thickness/2 ] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Object { ID "basket" Size [basket_size.x basket_size.y basket_size.z ] Position [basket_pos.x basket_pos.y basket_pos.z ] Dynamic 1 PhysicalAttributes { Material DEFAULT_MATERIAL CompositeMembers { Object "basket_wall1" Object "basket_wall2" Object "basket_wall3" Object "basket_wall4" Object "basket_floor" } } xVisualAttributes { Geometry { Primitive "box" } } } // ======================= // Create springs // ======================= stiffness 50 damping 1 natural_length 0.8 Joint { ID "spring1" Spring { NaturalLength natural_length Stiffness stiffness Damping damping } Object1 { // First object must be dynamic ID "basket" Position [ -basket_size.x/2 -basket_size.y/2 basket_pos.z+basket_size.z] } Object2 { ID "holder1" Position HOLDER_POS1 } Enabled 1 } Joint { ID "spring2" Spring { NaturalLength natural_length Stiffness stiffness Damping damping } Object1 { // First object must be dynamic ID "basket" Position [ basket_size.x/2 -basket_size.y/2 basket_pos.z+basket_size.z] } Object2 { ID "holder2" Position HOLDER_POS2 } Enabled 1 } Joint { ID "spring3" Spring { NaturalLength natural_length Stiffness stiffness Damping damping } Object1 { // First object must be dynamic ID "basket" Position [ basket_size.x/2 basket_size.y/2 basket_pos.z+basket_size.z] } Object2 { ID "holder3" Position HOLDER_POS3 } Enabled 1 } Joint { ID "spring4" Spring { NaturalLength natural_length Stiffness stiffness Damping damping } Object1 { // First object must be dynamic ID "basket" Position [ -basket_size.x/2 basket_size.y/2 basket_pos.z+basket_size.z] } Object2 { ID "holder4" Position HOLDER_POS4 } Enabled 1 } Object { ID "balls" Size [ 0.2 ] Position [0 0 4 ] Dynamic 1 CopyOp { Copies 10 PositionIncrement [0 0.01 1] } VisualAttributes { Geometry { Primitive "sphere" } } PhysicalAttributes { Mass 0.1 Material DEFAULT_MATERIAL Geometry { Primitive "sphere" } } } xObject { ID "bigball" Size [ 0.4 ] Position [-10 0 0.4 ] Dynamic 1 VisualAttributes { Geometry { Primitive "sphere" } } PhysicalAttributes { Mass 1 AngularDamping 0.001 AngularVelocity [0 50 0] LinearVelocity [10 0 0] Material DEFAULT_MATERIAL Geometry { Primitive "sphere" } } } rod_size { radius 0.1 length 10 } rod_pos { x 0 y 0 z -rod_size.length/2 } plane_size { x 1 y 1 z 0.1 } planar_pos { x -3 y -3 z 0 } Object { ID "rod" Size [ rod_size.radius rod_size.length ] Position [rod_pos.x rod_pos.y rod_pos.z ] Dynamic 1 VisualAttributes { Geometry { Primitive "cylinder" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "cylinder" } } } Object { ID "plane" Size [ plane_size.x plane_size.y plane_size.z ] Position [0 0 plane_size.z/2 ] Orientation [45 0 0] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Object { ID "planar" Position [0 0 0] Dynamic 1 PhysicalAttributes { Material DEFAULT_MATERIAL CompositeMembers { Object "rod" Object "plane" } } } // Planar does not react with floor CollisionPair { Object1 "planar" Object2 "floor" Enable 0 } Joint { ID "Prismatic1" Prismatic { } Object1 { // First object must be dynamic ID "planar" Position [0 0 0] } Position [0 0 0] Axis [ 0 0 1] // Make sure it is normalized LowerLimit 0 UpperLimit 10 DesiredVelocity 0.7 MaxForce 200 Enabled 1 } Object { ID "interact_box" Size [ 0.1 0.2 0.3 ] Position [0 -3 1 ] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Mass 1 AngularDamping 0.001 // AngularVelocity [0 50 0] // LinearVelocity [10 0 0] Material DEFAULT_MATERIAL Geometry { Primitive "box" } } } Joint { ID "Kinematic1" Position [0 0 0] Object1 { ID "interact_box" // "basket"// } LinearStrength [0 0 0] Enabled 1 Kinematic { } } xJoint { ID "MousePickJoint" Position [0 0 0] Object1 { ID "interact_box" } Enabled 0 Kinematic { LinearStrength [100 100 100] } } leg { size { x 0.1 y 0.1 z 0.3 } } chair { size { x 0.5 y 0.5 z 0.1 } height leg.size.z+0.1 } // Create seat of the chair Object { ID "seat" Size [chair.size.x chair.size.y chair.size.z ] Position [0 0 leg.size.z+chair.size.z/2] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Material 1 Mass 10 LinearVelocity [0 0 0] AngularVelocity [0 0 0] Geometry { Primitive "box" } } } // Create back seat of the chair Object { ID "back-seat" Size [chair.size.z chair.size.y chair.size.x ] Position [-chair.size.x/2 0 leg.size.z+chair.size.z/2+chair.size.x/2] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Material 1 Mass 10 LinearVelocity [0 0 0] AngularVelocity [0 0 0] Geometry { Primitive "box" } } } // Create leg1 Object { ID "leg1" Size [leg.size.x leg.size.y leg.size.z ] Position [leg.size.x-chair.size.x/2 leg.size.y-chair.size.y/2 leg.size.z/2] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Material 1 Mass 1 LinearVelocity [0 0 0] AngularVelocity [0 0 0] Geometry { Primitive "box" } } } // Create leg2 Object { ID "leg2" Size [leg.size.x leg.size.y leg.size.z ] Position [-leg.size.x+chair.size.x/2 leg.size.y-chair.size.y/2 leg.size.z/2] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Material 1 Mass 1 LinearVelocity [0 0 0] AngularVelocity [0 0 0] Geometry { Primitive "box" } } } // Create leg3 Object { ID "leg3" Size [leg.size.x leg.size.y leg.size.z ] Position [leg.size.x-chair.size.x/2 -leg.size.y+chair.size.y/2 leg.size.z/2] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Material 1 Mass 1 LinearVelocity [0 0 0] AngularVelocity [0 0 0] Geometry { Primitive "box" } } } // Create leg4 Object { ID "leg4" Size [leg.size.x leg.size.y leg.size.z ] Position [-leg.size.x+chair.size.x/2 -leg.size.x+chair.size.y/2 leg.size.z/2] Dynamic 1 VisualAttributes { Geometry { Primitive "box" } } PhysicalAttributes { Material 1 Mass 1 LinearVelocity [0 0 0] AngularVelocity [0 0 0] Geometry { Primitive "box" } } } // Create the composite object, the chair, consisting of 6 objects. Object { ID "chair" Position [0 0 10+chair.height/2] Dynamic 1 PhysicalAttributes { CompositeMembers { Object "leg1" Object "leg2" Object "leg3" Object "leg4" Object "seat" Object "back-seat" } Material 1 LinearVelocity [0 0 0] AngularVelocity [0 5 0] Mass 1 LinearDamping 0.05 AngularDamping 0.05 } }