Question about CharController and NAN error
Posted: Thu May 03, 2012 8:23 am
Hey everyone I hope all is well!
What are the pros and cons between the "SimpleCharacterController" and the "SphereCharacterController" ?
I see they are both less featured and complex than the full CharacterController but what the performance and quality differences between the two?
Also as a seperate issue I am getting a NAN when changeing a dynamic sphere to kinimatic on the collision with a static object.
Code below
This is the code I use to throw the physicsball:
This is what I use to stop it when it collides with a static terrain object (also I would love to know if there is a better way.)
When I call MyPhysics.BecomeKinematic(); on the sphere after 2 frames its position is NAN
Anyone have any ideas...?
What are the pros and cons between the "SimpleCharacterController" and the "SphereCharacterController" ?
I see they are both less featured and complex than the full CharacterController but what the performance and quality differences between the two?
Also as a seperate issue I am getting a NAN when changeing a dynamic sphere to kinimatic on the collision with a static object.
Code below
This is the code I use to throw the physicsball:
Code: Select all
MyPhysics = new Sphere(in_Position, 0.3f, 10);
MyPhysics.LinearVelocity = in_Direction * 30;
MyPhysics.CollisionInformation.Events.ContactCreated += HasHitEvent;
PhysicsManager.GET.PhysicsSpace.Add(MyPhysics);
Code: Select all
private void HasHitEvent(EntityCollidable in_Sender, Collidable in_Other, CollidablePairHandler in_Pair, ContactData in_Contact)
{
EntityCollidable HitObj = in_Other as EntityCollidable;
if (HitObj != null)
{
if(HitObj.Entity.IsDynamic)
{
LivingPhysicsEntity HitEntity = HitObj.Entity.Tag as LivingPhysicsEntity;
if(HitEntity != null)
{
HitEntity.DoDamage();
}
}
else
{
//We are currently assumeing that this is a hit against the terrain
if (MyPhysics.IsDynamic)
{
MyPhysics.AngularMomentum = Vector3.Zero;
MyPhysics.LinearMomentum = Vector3.Zero;
MyPhysics.BecomeKinematic();
}
}
}
}
Anyone have any ideas...?