![]() |
Collision of an avatar with a quad
Hi all,
I'm having some problems with a task I'm making. I want to do something when an avatar touches a texquad. Therefore I created the texquad, added a collidebox around it and tested the situation. If I let the avatar touch the texquad in the beginning, something happens, but if I move the texquad 50 cm in front of the avatar and I let the avatar touch the texquad later, nothing happens. My code: Code:
import viz |
When you call collideMesh on an avatar, it saves the current mesh state of the avatar and performs all subsequent collision tests with this mesh. Animating an avatar will not update the collide mesh.
For some of our demos we added dynamic collisions with live avatars by constructing collision shapes for each major limb of the avatar and updating them every frame. We plan on including this code with the vizmocap module in a future release. I will try to post some of that code here when I get a chance. |
Please post this code as soon as you can. In the meantime, I could just move the quad (using a sensor) to the original position of the avatar I guess. I would gladly receive the code if you have the time however;)!
|
Hi Farshizzo,
Could you post the code for dynamic collision with live characters? The rest of the task is done now, and I have been struggling with the code to create something like you said (collision shapes for each major limb) but haven't been succesfull. I also tried to put avatar.collidemesh() into a timer, but that was too demanding (regarding the CPU I guess). Thanks in advance;)! |
Do you need dynamics on the collision, or do you just need to know when the avatar touches an object?
|
I don't really know what the difference is, but what my task is that a participant controlling an avatar has to touch several quads. Each quad has a bounding box around it, and every time the avatar touches the quad (i.e. enters the bounding box) the program checks if the number is the lowest of the 6 quads. If it is, the quad will turn green, otherwise the quad wil become red for a few seconds and then restore itself. This task is done multiple times.
So I think that I only need to know when the avatar (no matter which part of the avatar) touches the quads. Hope that clarifies the situation. |
Here is a sample script that shows how to setup collisions with the right hand of the avatar. Adding support for other body parts should not be too difficult.
Code:
import viz |
Farshizzo: thank you very much for the sample code! It works perfectly. I tried to do the same while using the live characters plugin and for some reason it didn't work then. I guess linking the box directly to the same tracker that also animated the avatar (so the same tracker was linked to a bone using MotionBuilder and to a box) could have been the problem. I will test this solution on monday and I will let you know if I still encounter some problems or if my problems are solved (during the weekends I don't have access to the live characters plugin).
|
Hi Farshizzo,
Your solution also worked in the lab! So thanks for your solution! Yours, Frank |
All times are GMT -7. The time now is 10:58 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC