as there are so many stuffs give for collision its quite confusing of wht to choose
i want that when two entities come in contact(just contact) at tht instance i want to decrease the health of character.
so this is wht i planned
if(body1.collideswith(body2))
{
body1.health-=1;
}
any way to get this logic
cause if i just check for collision, then till the time when the bodies r in contact ,health will reduce, but i want with one contact 1 health should reduce from the total.
How to check collision between two entities
Re: How to check collision between two entities
I would recommend using collision events. They can be accessed in the entity.CollisionInformation.Events property. There are events for initial collision, every frame the object is in collision, ending collision, and so on. I would recommend sticking to the deferred versions (past tense naming) for thread safe operations.
Some documentation about collision events can be found here:
http://bepuphysics.codeplex.com/wikipag ... umentation
Some documentation about collision events can be found here:
http://bepuphysics.codeplex.com/wikipag ... umentation
Re: How to check collision between two entities
any examples?
Re: How to check collision between two entities
The getting started demo has some simple event integration:
http://bepuphysics.codeplex.com/wikipag ... umentation
The main source download's BEPUphysicsDemos project also includes a "FishInABarrelDemo" which uses collision events.
http://bepuphysics.codeplex.com/wikipag ... umentation
The main source download's BEPUphysicsDemos project also includes a "FishInABarrelDemo" which uses collision events.
Re: How to check collision between two entities
thnks for the reply
i am using the bounding box method
//update function
if (Entity.BoundingBox.Intersects(Entity2.BoundingBox))
{
damage = true;
}
if(damage ==true)
{
health--;
damage=false;
}
and its working fine
i am using the bounding box method
//update function
if (Entity.BoundingBox.Intersects(Entity2.BoundingBox))
{
damage = true;
}
if(damage ==true)
{
health--;
damage=false;
}
and its working fine