WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   collission and scaling of objects (https://forum.worldviz.com/showthread.php?t=283)

Johannes 01-28-2005 02:25 PM

collission and scaling of objects
 
Hi,

collission-detection between objects does not seem to consider the scaling of objects.

I have a glider (developed in 3d Studio Max)

self.node = viz.add('../resources/joNew/glider2.wrl')

and scale it in vizard by self.node.scale(0.01,0.01,0.01)

If I call the



Code:

for object in collidablesBall:
                                        #Don't check for collisions with the same object
                                        if object == ball:
                                                continue
                                        #Perform the collision check with the room
                                        global gliderObj
                                        info = ball.collidingwith(object,1)
                                        #print 'hallo',info.intersected
                                        if info.intersected:
                                                print 'inBox',collidablesBall

I was always wondering, why I had a collision in free space...

Checked everything....Checked it again, as I now I'm no expert yet...

Then I took the scaling out and saw that it collided with the unscaled glider...

Is this right, what can I do?
Johannes

farshizzo 01-28-2005 02:35 PM

Hi,

Are you using collidemesh to check for collisions with the glider? The collidemesh function doesn't take scale into account. Try scaling the object within 3d Studio Max and re-exporting it.

Johannes 01-28-2005 03:16 PM

Yes, that's what I did and it works now, thank's.
Because the functions of collission are undocumented, I want to know what they do, here are my hypotheses - correct me, if I'm wrong:

object.collidemesh() activetes the mesh of the object, so others can collide with it.

info = ball.collidingwith(object,1)
info.intersected checks for the collision. For what stands the 1?

ball.collidesphere(0.025) can be used instead of collidemesh() for spherical objects - is maybe better because maybe ball.collidemesh() would construct a box-mesh?!

Thanks,
Johannes

farshizzo 01-28-2005 03:40 PM

Hi,

Here's some more info about each object.

collidemesh() - When checking collisions with the object, its underlying geometry will be used. Fore complex objects this is more accurate since the collisions are going to be performed per triangle, however it uses a lot more cpu.

collidesphere(radius) - When checking collisions with the object, a bounding sphere will be used with the given radius. This uses considerably less cpu power than checking collisions with a mesh. And if your object is already spherical, then this will be more accurate also.

collidebox(width,height,depth) - When checking collisions with the object, a bounding box will be used with the given dimensions. If you don't specify the dimensions, then Vizard will automatically calculate the objects bounding box. This also uses considerably less cpu than checking with the mesh.

collidingwith(object,mode) - This checks if the object is colliding with another object. If mode is 0 then this function will return 0 or 1 to signify that the objects are colliding. If mode is 1 then this function will return a VizIntersect object, which contains detailed information about the intersection.

Johannes 01-28-2005 03:49 PM

Thank you for this good explanation.

Is there something like collidecylinder(radius, height) ? More general, are all the "standard primitives" included?

Tank you and have a great weekend!
Johannes

farshizzo 01-28-2005 03:51 PM

Hi,

These are the only primitives currently supported. As I've mentioned before, this functionality isn't official yet. When it is finalized there will be more primitives to choose from, including cylinders.

Johannes 01-31-2005 10:19 AM

Remove
 
Thank you!

Removing of objects seems not to be possible?

Searching in this forum I found:

http://www.worldviz.com/forum/showth...ghlight=remove
"Currently you can't remove an object from memory, but you can make it invisible as you already did. We are hoping to have this feature by the next release also."

So the workaround is:
gliderObj.visible(False)

instead of gliderObj.remove()

Johannes

farshizzo 01-31-2005 11:08 AM

Hi,

That was from an older post, you should be able to remove objects permanently with the remove command.

Johannes 01-31-2005 01:43 PM

Yes, it works. Don't know what went wrong two hours ago...

Right now I'm trying to look at my room with the 3d-glasses (V8). I have been trying for more than two hours, but still have the following two problems:

I put this at the beginning of my file to initialize the tracker:

Code:

EYE_HEIGHT                        =1.8

viz.go(viz.PROMPT)

if viz.get(viz.TRACKER):
        myTracker = viz.add('vizppt.dls')
        myTracker.reset()  # Reset the tracker
        viz.tracker()

else:
        tracking = 0
       
viz.eyeheight(EYE_HEIGHT)


But unfortunately when I put on the glasses I find myself up above tha room.

2. When I turn my head, I can look aroung but it does not seem to track my movements as I'm walking around.

3. It feels like on the sea, everything is moving a little bit and that's quite exhausting.

Any ideas how to improve this?

On the computerscreen it looks and works fine.

Johannes

farshizzo 01-31-2005 01:56 PM

Hi,

Immediately after you add the tracker try issuing the following command:
Code:

myTracker.command(6,'',1,1,1)
This should take care of the problem of placing you above the room. Also, try issuing the following command to scale the ppt movement by 2. This might make the movement more noticeable:
Code:

myTracker.command(3,'',2,1,2)
If this still doesn't work, make sure the ppt is connected and that it is sending data. Also, check if Vizard prints out any errors about connecting to the ppt.

Johannes 02-01-2005 03:30 PM

Hi,
I'm still trying without sucess.
If I try this isolated piece below, I'm still up in the roof (about 2 m from the floor).

At least it tracks!


Code:

import viz
import vizmat
import time
import math
EYE_HEIGHT                        =1.8
viz.go(viz.PROMPT)
if viz.get(viz.TRACKER):
        myTracker = viz.add('vizppt.dls')
        myTracker.command(6,'',1,1,1)
        myTracker.command(3,'',2,1,2)
        v = viz.add('intersense.dls')
        myTracker.reset()  # Reset the tracker
        viz.tracker()
else:
        tracking = 0
viz.eyeheight(EYE_HEIGHT)

#Create a room
myroom = viz.add('../resources/models/room.wrl')

if I try other approaches, I'm on the floor but cannot track!
What do I need to change?

I also don't understand the following in the help-file

Average position by N samples

ppt.command(5,"",3) # Average over 3 samples


Does this steady the movement?


Set the reset mask for each axis

ppt.command(6,"",0,1,0) # Reset affect Y axis only

What is reset Mask - is it how it started?

and in gallery I found

factor = 5.0

guess this seems to make movements quicker (if I move 2 cm it tracks 10)??

Sorry for the many questions but I'm already trying to figure this out for some hours...

Johannes

Johannes 02-01-2005 04:04 PM

if I have the VR running I can also try to experiment with the rest.
So don't worry about the help-file-questions too much!

I also wondered if (and how) I could use the
mouse-motion during VR, it seems to be disabled because usually the head-mounted-display should take control.

Johannes

farshizzo 02-01-2005 04:20 PM

Hi,

Can you try the following script and tell me what it prints out:
Code:

import viz
viz.go()

ppt = viz.add('vizppt.dls')
ppt.command(6,'',1,1,1)
ppt.reset()

viz.tracker()

viz.eyeheight(1.8)

def ontimer(num):
        print viz.get(viz.HEAD_POS)[1]

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0.1,viz.FOREVER)

It should load the ppt tracker, set the eyeheight to 1.8, and continuously print out the latest height of the viewpoint.

The average command will tell the ppt to average the position over the last N number of samples.

The reset mask controls which axes are affected by the reset command. By default all axes should be affected by the reset, but there was a bug in the ppt plugin which caused the y axis to not be affected.

Johannes 02-01-2005 04:33 PM

hi,
it prints out this:

************************************************** ****************************
* VIZARD 2.50b *
* *
************************************************** ****************************

vizppt.dls WorldViz PPT v1.1
** NOTIFTY: Connected to PPT on COM1
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50404047966
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.5034301281
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50404047966
2.50373530388
2.50373530388
2.5034301281
2.5034301281
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.50373530388
2.5034301281
2.50373530388
2.50526118279
2.50098872185
2.4985473156
2.50190424919
2.51868891716
2.54584956169
2.60383296013
2.68378901482
2.79884028435
2.92274165154
3.02680659294
3.08356928825
3.100659132
3.07532954216
3.042065382
3.01215815544
2.993237257
2.99567866325
3.02924799919
3.1040160656
3.19923090935
3.31916499138
3.43543696404
3.56544184685
3.66096186638
3.7094848156
3.69178462029
3.63105463982
3.50501704216
3.32954096794
3.12781977654
2.93494868279
2.78236079216
2.67982172966
2.62122797966
2.57728266716
2.54157710075
2.51990962029
2.48969721794
2.4692504406
2.46955561638
2.47291254997
2.47352290154
2.47474360466
2.47474360466
2.47474360466
2.47810053825
2.47779536247
2.47810053825
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47810053825
2.47779536247
2.47810053825
2.47779536247
2.47810053825
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47810053825
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47779536247
2.47749018669
2.47779536247


so it seems the ey-height is really off!

This is the gallery-part which works fine. Guess somebody fitted it, because it is called gallery_rutgers.py

Code:

import viz
import time
import Avatar
import math
import sid
import vizmat


#  viz.displaymode(1280,480)
#  viz.go(viz.PROMPT | viz.HMD | viz.STEREO | viz.TRACKER)

SHOW_VIDEO = 1
SHOW_MONA = 1
PLAY_AUDIO = 1
PLAY_MEDIA = 1
USE_JOYSTICK = 1
SHOW_AVATAR_R2 = 1

#  EYE_HEIGHT                        = 1.8
EYE_HEIGHT                        = -0.1

viz.go(viz.PROMPT)

if viz.get(viz.TRACKER):
        v = viz.add('intersense.dls')
        v = viz.add('intersense.dls')
        pos = viz.add('vizppt.dls')
        pos.command(5,'',3)
        pos.factor = 5.0

        viz.eyeheight(EYE_HEIGHT)
        #Do automatic tracking for head
        viz.tracker()
               
#        pos = viz.add('vizppt.dls')
#        pos.command(4.002)
#        pos.command(13)
#        pos.factor = 2.0
#        viz.tracker()
#        v.reset()
        tracking = 1
else:
        tracking = 0
       
viz.eyeheight(EYE_HEIGHT)

if viz.get(viz.TRACKER):
        viz.fov(40, 1.33)

So I guess I have to set eye_height to something like -1 or play around with it, or what would you recommend?

Johannes

farshizzo 02-01-2005 04:40 PM

Hi,

Try the following instead. After the script has started press the 'r' key to reset the ppt:
Code:

import viz
viz.go()

ppt = viz.add('vizppt.dls')
ppt.command(6,'',1,1,1)
ppt.reset()

viz.tracker()

viz.eyeheight(1.8)

def ontimer(num):
        print viz.get(viz.HEAD_POS)[1]

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0.1,viz.FOREVER)

def onkeydown(key):
        if key == 'r':
                ppt.reset()

viz.callback(viz.KEYDOWN_EVENT,onkeydown)


Johannes 02-01-2005 05:23 PM

Hi,
now I got the following data which seems to be correct. But as you already reset at the beginning, why again with pressing r. Does it not do it?

Johannes

P.S. The data-output

************************************************** ****************************
* VIZARD 2.50b *
* *
************************************************** ****************************

vizppt.dls WorldViz PPT v1.1
** NOTIFTY: Connected to PPT on COM1
2.47138667107
2.47169184685
2.47138667107
2.47169184685
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47108149529
2.47138667107
2.47108149529
2.47138667107
2.47169184685
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47108149529
2.47138667107
2.47138667107
2.47169184685
2.47108149529
2.47169184685
2.47169184685
2.47169184685
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47169184685
2.47108149529
2.47138667107
2.47138667107
2.47169184685
2.47169184685
2.47138667107
2.47138667107
2.47138667107
2.47169184685
2.47169184685
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47169184685
2.47138667107
2.47138667107
2.47108149529
2.47138667107
2.47108149529
2.47108149529
2.47108149529
2.47138667107
2.47169184685
2.47138667107
2.47169184685
2.47108149529
2.47138667107
2.47138667107
2.47108149529
2.47138667107
2.47138667107
2.47169184685
2.47138667107
2.47230219841
2.47108149529
2.47138667107
2.4707763195
2.47443842888
2.50281977654
2.55134272575
2.651440382
2.76893305779
2.90473628044
3.04786372185
3.18031001091
3.29169917107
3.3872191906
3.47846674919
3.54591059685
3.57215571404
3.54530024529
3.4653441906
3.33381342888
3.17695307732
3.0112426281
2.85712885857
2.74848628044
2.64716792107
2.57636713982
2.53028559685
2.48695063591
2.47108149529
2.4692504406
2.47199702263
2.47199702263
2.47230219841
2.47199702263
2.47138667107
2.47199702263
2.47169184685
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47169184685
2.47199702263
2.47169184685
2.47199702263
2.47199702263
2.47169184685
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47199702263
2.47169184685
************************************************** ****************************
* VIZARD 2.50b *
* *
************************************************** ****************************

vizppt.dls WorldViz PPT v1.1
** NOTIFTY: Connected to PPT on COM1
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
2.47138667107
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.79999995232
1.7969481945
1.79938960075
1.82838129997
1.89582514763
2.0053832531
2.104565382
2.21412348747
2.30689692497
2.40546870232
2.53638911247
2.69630122185
2.836987257
2.94837641716
3.04786372185
3.10157465935
3.12171626091
3.11835932732
3.1040160656
3.08417963982
3.06708979607
3.03535151482
2.98011469841
2.86842036247
2.70576167107
2.53638911247
2.36976313591
2.20130610466
2.04658198357
1.94709467888
1.87568354607
1.85340571404
1.83906245232
1.82899165154
1.82868647575
1.8296020031
1.82838129997
1.82746577263
1.82685542107
1.82746577263
1.82685542107
1.83051753044
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.82990717888
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.82990717888
1.83021235466
1.82990717888
1.83021235466
1.83021235466
1.83021235466
1.83021235466
1.82990717888
1.82990717888

farshizzo 02-01-2005 05:25 PM

Hi,

You can remove the reset at the beginning. The reason it didn't work before was that the reset was being called too early. The ppt didn't have a valid data sample, so it could not reset the position.

Johannes 02-01-2005 05:44 PM

OK,
also the data looks alright now, when I put the room (the normal myroom from your 1 tutorial) in there I'm still too high.

line I added:
#Create a room
myroom = viz.add('../resources/models/room.wrl')

I also cannot look arount. If also write
v = viz.add('intersense.dls')
below the line ppt = viz.add('vizppt.dls') it works better with moving and lookint to the floor.
What might be the mistake?
Johannes

Here the code with the two lines included:
Code:

import viz
viz.go(viz.PROMPT)
ppt = viz.add('vizppt.dls')
v = viz.add('intersense.dls')
ppt.command(6,'',1,1,1)
ppt.reset()
viz.tracker()
viz.eyeheight(1.8)
def ontimer(num):
        print viz.get(viz.HEAD_POS)[1]
viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0.1,viz.FOREVER)
def onkeydown(key):
        if key == 'r':
                ppt.reset()
viz.callback(viz.KEYDOWN_EVENT,onkeydown)
#Create a room
myroom = viz.add('../resources/models/room.wrl')


farshizzo 02-01-2005 07:08 PM

Hi,

When you say you cannot look around, are your referring to the intersense or mouse?

Johannes 02-01-2005 08:24 PM

I was referring to the myself wearing the head mounted display. But yes, the intersense is on that thing :) (if it is that cube, that seems to have a gyroscope in it).

Best,
Johannes

farshizzo 02-02-2005 11:31 AM

Hi,

Are you getting any error messages printed out? When the intersense connects it should print out a bunch of information. If it fails it should print out an error message.

Johannes 02-02-2005 03:40 PM

1 Attachment(s)
Hi,

no I don't think I get any error messages.

My hypothesis is, that somehow the eyeheight of my system is setup wrong. As I compared the two gallery files - one the original in the examples and one that was changed for Rutgers (I think Matthias did it) I found the following differences (see attached Word-File).

But how could I change it? Is it callibrated wrong? Do I just have to live with it?

So what does this acutally do?
ppt = viz.add('vizppt.dls')
v = viz.add('intersense.dls')

In the help I read:

vizppt.dls
All WorldViz PPT optical trackers

intersense.dls
All Intersense trackers


I know that the intertia-cube is from intersense so I have to include the second command. But is it maybe wrong to use the vizppt.dls ?
Johannes

farshizzo 02-02-2005 04:42 PM

Hi,

From your previous posts it seems as though the eyeheight is correct. The test script outputs values that are close to 1.8, which is the eyeheight you set it at. Maybe the room model you are using is too small.

ppt = viz.add('vizppt.dls')

This command will add the vizppt tracker, which only outputs positional data.

v = viz.add('intersense.dls')

This command will add the intersense tracker, which only outputs orientation data.

If you want to track a users position and orientation then you will have to add both trackers.

If the intersense tracker fails to connect then you will get an output message along the lines of "** ERROR: Failed to connect to intersense tracker". If the connection succeeds then you will get an output message that displays information about the connected tracker. Which one of these output messages are you getting?

Johannes 02-02-2005 05:07 PM

Hi,
I don't think I got any error messages, but I will try again tomorrow (because it always takes some time to change resolution, put the computer on...). I will email this then.

I also wondered if (and how) I could use the
mouse-motion during VR, it seems to be disabled because usually the head-mounted-display should take control.

Johannes

farshizzo 02-02-2005 05:10 PM

Hi,

To enable mouse motion you will have to stop the trackers:
Code:

viz.tracker(viz.STOP)

Johannes 02-02-2005 05:29 PM

Thank you, have a great evening,
Johannes

Johannes 02-03-2005 01:43 PM

Hi,
today I just played around with the eye-height and yes, this is the problem. Somehow it seems to be callibrated wrong.

The following works:

viz.go(viz.PROMPT)
ppt = viz.add('vizppt.dls')
v = viz.add('intersense.dls')
ppt.command(6,'',1,1,1)
ppt.reset()
viz.tracker()
viz.eyeheight(-0.3)

I will have to see if we can recalibrate or just live with it...
Johannes

Johannes 02-08-2005 08:46 AM

What would you recommend to fix the below problem? (No hurry, as I said, it works for now).

Johannes

farshizzo 02-08-2005 11:08 AM

Hi,

I don't think I understand what your problem is right now. I thought the eyeheight problem was solved with my previous post. Is the problem with the intersense?


All times are GMT -7. The time now is 02:33 PM.

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