public void CheckIfStandingOnObject() { float capsuleHalfHeight = ((CAPSULE_LENGTH + 2 * CAPSULE_RADIUS) * 0.5f); tempVector5RayCast.setValue(m_position.X, m_position.Y, m_position.Z); tempVector6RayCast.setValue(m_position.X, m_position.Y, m_position.Z - capsuleHalfHeight * 1.1f); ClosestCastResult.Dispose(); ClosestCastResult = new ClosestNotMeRayResultCallback(Body); try { m_parent_scene.getBulletWorld().rayTest(tempVector5RayCast, tempVector6RayCast, ClosestCastResult); } catch (AccessViolationException) { m_log.Debug("BAD!"); } if (ClosestCastResult.hasHit()) { if (tempVector7RayCast != null) { tempVector7RayCast.Dispose(); } //tempVector7RayCast = ClosestCastResult.getHitPointWorld(); /*if (tempVector7RayCast == null) // null == no result also * { * CollidingObj = false; * IsColliding = false; * CollidingGround = false; * * return; * } * float zVal = tempVector7RayCast.getZ(); * if (zVal != 0) * m_log.Debug("[PHYSICS]: HAAAA"); * if (zVal < m_position.Z && zVal > ((CAPSULE_LENGTH + 2 * CAPSULE_RADIUS) *0.5f)) * { * CollidingObj = true; * IsColliding = true; * } * else * { * CollidingObj = false; * IsColliding = false; * CollidingGround = false; * }*/ //height+2*radius = capsule full length //CollidingObj = true; //IsColliding = true; m_iscolliding = true; } else { //CollidingObj = false; //IsColliding = false; //CollidingGround = false; m_iscolliding = false; } }