using sensor data in Physics1.py
I'm trying to change the code of physics1.py and use sensor data to control a ball to bump into other objects. Please see the following code. The yellow ball linked with sensor behaves erratically, though the printed sensor data seems okay. I wonder whether that because I try to link a dynamic object to a sensor. Is it possible to "turn off" the dynamics on this ball (e.g. gravity) while keep its collision response (I mean, when it collides with other objects, it will push them out of the way with seemingly infinite force)?
Code:
viz.enable(viz.PHYSICS) Any ideas? Thank you. |
Hi,
This would require the use of a joint to control the balls position while performing dynamics on it. Currently, the physics plugin doesn't have an interface for creating joints. Instead of linking the sensor to the ball, use the following code in your timer to place it manually. Code:
data = sensor1.get() |
Thanks a lot. I just tried this code. Now the ball bounces once in each timer cycle when physics applies.
Any other solutions? |
Try having your timer expire every frame, instead of every half second.
Code:
viz.starttimer(0,0,viz.FOREVER) |
it looks much better. Thanks a lot
|
All times are GMT -7. The time now is 04:29 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC