WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-19-2017, 05:33 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
Cooperation of things within the Virtual world

Hello,

So i wrote a Program where i implemented a STL-Data (Basicly a Matlab created cuboid that should simulate a heating system).
Recently i started to use physics in my Program.

Code:
viz.setMultiSample(4)
vizconnect.go('vizconnect_hand_vive.py') 
viz.phys.enable() 
viz.collision(viz.ON)

ground = viz.addChild('ground_gray.osgb')
ground.collideplane()
Heizung = viz.addChild('heiz2.osgb')
Heizung.collideBox()
I set the ground as bottom and enabled the Heizung for physics via the CollideBox command.
The problem that i have now is that the cuboid (who is higher than he is wide) just drops over to the front. What i want it to do tho is to fix that cuboid at the bottom so it basicly simulates an imobile machine. So the question is can i attach that Child to the ground level and make it kinda "heavy" as if a massive metal block would stand there.

And on top of that i wanted to figure out a way to attach smaller boxes to it. Basicly if i take a generated box and put it at a certain point of the Big block it gets attached to that point.

Code:
box1 = vizshape.addCube(size=0.2, pos=[0,1.45,5.4],alpha=1)
box1.collideBox()
So if i take that Box and put it at a certain point (that i defined before) somewhere on the side of my "Heizung" it gets attached to that automatically and stays at that point? But if i grab it again i want to be able to remove it again aswell.

Thanks in Advance
Reply With Quote
  #2  
Old 01-23-2017, 12:45 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,446
Reducing the bounce of the box may help prevent it from falling over after it's dropped. Here's an example:

Code:
'''
Press spacebar to enable physics and drop the box
'''

import viz
import vizact
import vizshape
import vizinfo

viz.go()
vizinfo.InfoPanel()

viz.clearcolor(viz.SLATE)
ground = viz.add('ground.osgb')
ground.collidePlane()

box = vizshape.addBox(size=(.4,2,0.4),pos=[0,20,8])
shape = box.collideBox()
shape.setBounce(0.01)

vizact.onkeydown(' ',viz.phys.enable)
If you want objects to snap into place after colliding try handling the collision event and then animate or directly place the object where you want it to go.
Reply With Quote
  #3  
Old 01-24-2017, 04:15 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
The problem is not that the boxes drop but the osgb i imported

The Heizung Attribute is a STL data i implemented and edited it with the inspector. The boxes i implemented work perfectly fine they drop and lay staticly on the ground after they fell but the heiz1.osgb (a picture of it is attached) just drops over and i dont know why it does that in first place when i enable the phisycs
Attached Thumbnails
Click image for larger version

Name:	import.jpg
Views:	231
Size:	82.0 KB
ID:	901  
Reply With Quote
  #4  
Old 02-02-2017, 03:37 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
Hey,

just a quick question to the topic above again.
I think i found the problem. Like the Screenshot shows, the center of gravity is at the down left front corner of the object. so i think the physics apply at that point and thats why the object drops so weird on the ground.
I found sth about the pivot point in the documentary which defines the the turn axe of the object. Does that point also determines where the physics apply?
So i just had to move the point in the screenshot to the center of the object and i guess the problem would be solved. I found the solution in the documentary but all these functions are not shown in my instructor, so my question is how do i move that center of gravity?
Sorry to bother you so much but thanks for the help in advance
Reply With Quote
  #5  
Old 02-02-2017, 05:30 AM
Patrick Patrick is offline
Member
 
Join Date: Oct 2016
Posts: 13
Forgot to attach the Screenshot
here we go
Attached Thumbnails
Click image for larger version

Name:	Unbenannt.png
Views:	266
Size:	214.1 KB
ID:	903  
Reply With Quote
  #6  
Old 02-02-2017, 05:12 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,446
The node.setCenter command will change the object's center of rotation. I'm not sure but it might also help in this case.
Reply With Quote
Reply

Tags
@jeff

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Augmented Reality: virtual world not overlapping real world correctly Vaquero Vizard 7 04-15-2016 02:14 AM
Making Virtual World Using Video Recording Hitesh Vizard 2 06-22-2015 10:03 AM
Showing another program in a virtual world Frank Verberne Vizard 3 01-16-2013 11:26 AM
why is time faster in my virtual world? billjarrold Vizard 1 11-24-2009 06:33 PM
Vizard as a social virtual world engine Gerard Vizard 3 02-14-2008 03:22 PM


All times are GMT -7. The time now is 03:51 AM.


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