![]() |
|
#1
|
|||
|
|||
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). |
#2
|
|||
|
|||
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 CHANGE_STATE_TIMER = 0 SET_COLLIDE_SHAPE_TIMER = 1 viz.go() viz.MainView.setPosition( 0, 2, -5 ) viz.phys.enable() g = viz.add( 'tut_ground.wrl' ) g.collidePlane() male = viz.add( 'male.cfg' ) male.currentState = 1 male.state( male.currentState ) def onTimer(num): if num == CHANGE_STATE_TIMER: male.currentState = (male.currentState+1) % 2 male.state( male.currentState ) viz.starttimer( SET_COLLIDE_SHAPE_TIMER, .2, viz.FOREVER ) elif num == SET_COLLIDE_SHAPE_TIMER: male.collideNone() male.collideMesh() male.disable( viz.DYNAMICS ) viz.callback(viz.TIMER_EVENT,onTimer) viz.starttimer( CHANGE_STATE_TIMER, 3, viz.FOREVER ) ball = viz.add('ball.wrl') g=ball.collideSphere() def shootAhead(): ball.reset() view = viz.get(viz.MAIN_VIEWPOINT) ball.translate(view.get(viz.HEAD_POS)) vec = viz.Vector(view.get(viz.VIEW_LOOK)[:3]) ball.setVelocity(vec*20) vizact.onkeydown(' ',shootAhead)
__________________
Paul Elliott WorldViz LLC |
#3
|
|||
|
|||
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): viz.waitframe(10) avatar.collidemesh() avatar=viz.add('Female.cfg') avatar.state(1) avatar.visible(viz.ON) avatar.translate(x,y,theta) viz.director(fix_mesh,avatar) |
#4
|
|||
|
|||
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
__________________
Paul Elliott WorldViz LLC |
#5
|
|||
|
|||
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. Last edited by pbeeson; 09-11-2006 at 06:57 PM. |
#6
|
|||
|
|||
![]()
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: info = x.collidingwith(obj,1) print info.intersected 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 Last edited by pbeeson; 09-11-2006 at 07:39 PM. |
#7
|
|||
|
|||
Problem demonstration
EXAMPLE of bug with v3.0 and collidingwith()
Code:
import viz CHANGE_STATE_TIMER = 0 SET_COLLIDE_SHAPE_TIMER = 1 CHECK_COLLIDE=2 viz.go() viz.MainView.setPosition( 0, 0, -25 ) male = viz.add( 'male.cfg' ) male.state(1) male.translate(10,0,0) male2 = viz.add( 'male.cfg' ) male2.state(1) male2.translate(-10,0,0) def onTimer(num): if num == SET_COLLIDE_SHAPE_TIMER: male.collideNone() male.collideMesh() male.disable( viz.DYNAMICS ) male2.collideNone() male2.collideMesh() male2.disable( viz.DYNAMICS ) elif num==CHECK_COLLIDE: info=male.collidingwith(male2,1) print info.intersected viz.callback(viz.TIMER_EVENT,onTimer) viz.starttimer( SET_COLLIDE_SHAPE_TIMER, 1, 1 ) viz.starttimer( CHECK_COLLIDE, 2, viz.FOREVER ) |
#8
|
|||
|
|||
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 ): print 'intersected' else: print 'not intersected'
__________________
Paul Elliott WorldViz LLC |
![]() |
|
|