cancel
Showing results for 
Search instead for 
Did you mean: 

JackScript collision detection not finding any collisions

Valued Contributor
Valued Contributor

Using Jack's UI, I added Jack and a chair to the scene. My goal is to use JackScript to detect collisions. So, I moved Jack to the middle of the chair so that his legs run through it. 

The chair that I am using came with Jack and is C:\Program Files\Siemens\Jack_8.4\library\data\old_furniture\chair.pss.



In the Python console I ran the following commands:

JackScript: 
Python: 2.6.6 (r266:84292, Mar  2 2015, 10:25:27) [MSC v.1800 64 bit (AMD64)]
>>> scene.GetList(Figure)
[<Human human at 0x464bf144>, <Figure chair at 0x464c8404>, <Figure camera at 0x464c8544>]
>>> cs = CreateCollisionSet(scene.human, scene.chair)
>>> CollisionSet_GetList()
[<jsCollision.CollisionSet at 0x464bd304>]
>>> cs.Check()
0
>>> cs.Pairs()
[]
>>> cs.Collisions()
[]

As illustrated, there are no collisions being detected, but I would expect some since Jack is standing in the middle of the chair.

Why aren't there any collisions? Am I setting up the scene right?

2 REPLIES

Re: JackScript collision detection not finding any collisions

Experimenter
Experimenter

I am working on the same issue. Here are some additional details in my case: 

I can use the JackScript 8.4 console to add a human and a cube, and walk the human over to the cube. 

Then in the Classic Jack 8.4 UI, I can use the menu choices and dialog boxes to create a collision set. When my JackScript walks the human into the cube, a collision will be shown correctly in red. 

However, I cannot see that collision set in the JackScript console. Even if I call CollisionSet_GetList(), it will not be listed.  

Then, like redpepper, if I create a CollisionSet object in JackScript, everything appears to work. I can call Add to load the human and the cube. But after that, Pairs() is always empty. Check() always returns 0, and Collisions returns []. It will not detect the collisions that are shown by the collision sets in the UI. 

 

>>> john = CreateHuman("john")
>>> box1 = CreateFigure("cube.pss", "box1")
>>> cs1 = CollisionSet()
>>> cs1.Add(john,box1)
>>> john.WalkTo(box1, velocity=0.7)
<LinearWalkMotion at 4d96408c on 'john'>
>>> cs1.Pairs()
[]
>>> cs1.Check()
0
>>> cs1.Collisions()
[]

Re: JackScript collision detection not finding any collisions

Valued Contributor
Valued Contributor

I contacted GTAC and talked with nice support people. I learned that the jsCollision module methods I was using in the code example only work if the human being used is a v6.1 Segmented Male/Female. This human model is not the default for Jack 8.4. In order to get the v6.1 human from the menu, click Human -- Create -- Human from Library... -- v6.1 Segmented [Male | Female]. The only information that was conveyed to me from GTAC regarding retrieval of collision information using the default human was that such information can be obtained via the jsExtCollision.TestPair method, which 1) returns a boolean, 2) provides excellent results, and 3) should take the whole human mesh figure as a parameter, so not just a body part (e.g. finger, head, hand).

 

The reason why the jsCollision module methods do not work with the new/default human is because those humans (v7.0) are not segmented. They said, "We do not currently support body part collision checks on the smooth [unsegmented] human."

 

There is also no API support to get the spatial location/coordinates of collisions.