Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: [Not a Bug]TV Physics TV_EVENT_PHYSICSCOLLISION iBody2  (Read 813 times)
serial
Customers
Community Member
*****
Posts: 380


« on: August 31, 2010, 04:20:46 AM »

Code:
TV_EVENT_PHYSICSCOLLISION coll = pEngine.GetEventCollisionDesc(EventNumber);
Console.WriteLine(coll.iBody2.ToString());

As far as collision events go iBody2 seems to be return physics bodies that don't
even exist. 

For example I setup a landscape and the ID that is return is 17
int landID = pEngine.CreateStaticTerrainBody(land);

landID will equal 0.

Then I create a spherical phsyics body
int ballID = pEngine.CreateBody(1);
pEngine.AddMesh(ballID, ball, CONST_TV_PHYSICSBODY_BOUNDING.TV_BODY_SPHERE, true);

ballID will equal 17.

But coll.iBody2 returns 1.

If I reverse it(create the ball phsyics body first then the land physics body)  ballID will be 0, landId will be 1 and coll.iBody2 returns 2. 

I'm assuming iBody1 and iBody2 return the index of the physics bodies that collide. 



« Last Edit: September 02, 2010, 02:21:12 AM by serial » Logged
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #1 on: August 31, 2010, 04:51:34 AM »

If this is about TVLandscape and TVPhysics.CreateStaticTerrainBody, this actually isn't a bug. The TVPhysics.CreateStaticTerrainBody actually creates one Physics static body for overhead, then static one physics body for each chunk in the TVLandscape. So if you created the land with TVLandscape.GenerateTerrain("...", CONST_TV_LANDSCAPE_PRECISION...., 4, 4, ..., ..., ..., ...), that's 4 X 4 chunks, plus an overhead is 17 static physics bodies. You should also find that a collision should never occur with the overhead static physics body, 0 in this case (1 in the second case you've stated).

If it ever returns the overhead body, that might be a bug as that should not happen. Also note that creating a static physics body with a mesh should create only one static physics body with no overhead.
Logged

JAbstract.....Don't just imagine, make it happen!
serial
Customers
Community Member
*****
Posts: 380


« Reply #2 on: September 02, 2010, 02:22:28 AM »

Thanks...That is what it was. Seems like checking for collision results between materials is a better way to get when it comes to landscapes. 

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks