Collidemesh with Avatars
It seems as if the mesh that collidemesh uses for the Male and Female avatars is the default pose (with their arms outstretched). This is true even is the avatars are in another state (e.g. lady.state(1)). Is there a way to get around this? Or am I doing somehting worng: I am calling collidemesh() after I set the avatar's state.
|
Hi,
Setting the state of the avatar does not immediately affect its mesh state. You must wait until the next frame is drawn to ensure the mesh has been modified to reflect the new state. So you need to wait a frame and then call collideMesh() if you want it to reflect the new state. |
Also, be sure to remove the previous mesh VizPhysicsShape object with
|
There is no collideNone() function.
Plus, even if I wait 10 frames, occasionally, I still run into an avatar as if its arms were outstreched even though I waited 10 frames before calling collidemesh() after setting its to state(1) (standing with arms by side). |
Here is a little script that keeps changing the collideMesh shape of the avatar. I think this is what you want to do. Run it with the latest Vizard Beta release.
Code:
import viz |
I'm not using version 3.0. Thus, I don't have collideNone(). Can you provide me help with version 2.5? I've switched to using collidebox instead of collide mesh for the time being to get around this problem, but I'd like a better answer.
In v 2.5, if you do the following for two avatar then later use collidingwith(), sometimes the collisions occur as if the avatars are in state #1 (correct behavior), and sometimes one or both of the avatars provide collision info as if they were still in the idle pose (arms outstreatched). Can't get this to work properly every time. Code:
def fixmesh(avatar): |
I suggest that you start using Vizard 3.0. It has vastly improved physics support. You can download it here:
http://www.worldviz.com/download/?id=9 |
Although I plan to switch to Vizard 3.0 at some point, given that I need to gather and analyze data for a grant proposal due next week, I'm sticking with version 2.5 for now. So, any help you can give men with my problem in version 2.5 would be welcome.
It's kind of distressing that several of my recent posts on Vizard 2.5 problems have been answered with "switch to version 3.0". If I want to switch to the 3.0 beta, I can only use this for a limited time, then I am unsure as to how much it will cost my supervisor to upgrade our entire lab. On a more positive note, I have received excellent support on many of the previous problems/questions I've had with Vizard 2.5. |
Let me try and address your very reasonable 3.0 concerns.
--There will be beta licenses avalable until 3.0 is released. --Upgrading will be free. --Vizard 3.0 is very backwards compatable. Just give your script a quick spin in 3.0. Even if your project is quite complex I doubt it would take more than an hour of work to migrate over. |
So, in desparation, I installed version 3.0, and as I suspected, enough has changed to make it appear infeasible to port my code in 1 day (I am on a bit of a time crunch here).
Mainly, collidingwith doesn't work. Code:
for x in self.collidables: True False True False . . . It flips back and forth between true and false for the entire list of objects. But, the same code works fine in version 2.5 (note I added the collideNone() commands before the collidemesh() commands before running in v3). So, given that I can't refactor thousands of lines of code in a day, I was hoping you could solve the original version 2.5 problem. Or fill me in on how to EASILY get v3.0 working --- by easily I mean 1-2 lines of changes (I don't have time to play with the new physics engine and collision events, though they look cool). Thanks for all the help |
Problem demonstration
EXAMPLE of bug with v3.0 and collidingwith()
Code:
import viz |
You can replace the collidewith function with viz.phys.intersectNode()
For your previous for loop collidewith code replace with: Code:
if x in viz.phys.intersectNode( obj ): |
Any other 3.0 migration problems?
|
It looks like viz.phys.intersectLine is faster than the old viz.intersect. But, the old intersect would ignore objects that were not visible.
1) Is there any way to tell viz.phys.intersectLine to ignore certain objects? object.disable(viz.COLLISION) doesn't seem to work, neither does turning off visibilty. I can run viz.phys.intersectLine(begin,end,True) to get a list and then check object IDs, but I don't know if there is an easier way (especially considering that if you have many objects, it might be an optimzation to not check for intersections with particular objects at certain times). (This is also where thread 729 ended up). 2) Is there any way to get better documentation on these commands that he skeletal docs in the Vizard Help or in Python help()? |
1) viz.phys.intersectLine() works on the physics simulation level so it only intersects with physics shapes. To have it ignore nodes, remove their VizPhysicsShape with a call to collideNone().
2) Vizard Help is the best option right now. Of course the forum is fairly good too:) |
All times are GMT -7. The time now is 06:35 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC