WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Physics engine question (https://forum.worldviz.com/showthread.php?t=171)

adimov 07-20-2004 11:23 PM

Physics engine question
 
I am using the physics engine and when I run the following code:

cane2=viz.add('cane2.WRL')
cane2.scale(.007, .007, .007)
gravity = viz.addplane(0,1,0,0)
body = viz.addbody()
body.addbox(0.05,1.5,0.05,1)
cane2.link(body)

the object cane2 shoots up in the air before falling down on the ground...

Actually, let me explain what I want to do: I want to have an object in a world that I will position in an arbitrary location, resize and rescale it. Then, when I press a key, I would like to enable the physics engine and have the object fall. It may be easer to show me how to do that. I've followed the physics2 example, but will need more help.
Thanks very much,

Alex from RECVEB

farshizzo 07-21-2004 09:40 AM

Hi Alex,

First I'd like to say that the physics engine interface has not been finalized yet, so it may change in future versions. The reason the object initially shoots up is because it starts out partially below the ground plane, so the physics engine is overcompensating in order push it out. You can either translate the body above the ground plane, or disable it by calling body.disable(). Later you can use body.enable() to have it fall down. What you want to do sounds fine, except for rescaling the object. Currently there is no way to rescale a physics object.

adimov 07-22-2004 12:33 PM

Thanks, enable() and disable() did the job!


All times are GMT -7. The time now is 10:04 PM.

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