00001 // Filename: physxRaycastHit.cxx 00002 // Created by: enn0x (21Oct09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "physxRaycastHit.h" 00016 #include "physxManager.h" 00017 #include "physxShape.h" 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: PhysxRaycastHit::is_empty 00021 // Access: Published 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 bool PhysxRaycastHit:: 00025 is_empty() const { 00026 00027 return (_hit.shape == NULL); 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: PhysxRaycastHit::get_shape 00032 // Access: Published 00033 // Description: 00034 //////////////////////////////////////////////////////////////////// 00035 PhysxShape *PhysxRaycastHit:: 00036 get_shape() const { 00037 00038 nassertr_always(_hit.shape, NULL); 00039 return (PhysxShape *)_hit.shape->userData; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: PhysxRaycastHit::get_impact_pos 00044 // Access: Published 00045 // Description: 00046 //////////////////////////////////////////////////////////////////// 00047 LPoint3f PhysxRaycastHit:: 00048 get_impact_pos() const { 00049 00050 return PhysxManager::nxVec3_to_point3(_hit.worldImpact); 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: PhysxRaycastHit::get_impact_normal 00055 // Access: Published 00056 // Description: 00057 //////////////////////////////////////////////////////////////////// 00058 LVector3f PhysxRaycastHit:: 00059 get_impact_normal() const { 00060 00061 return PhysxManager::nxVec3_to_vec3(_hit.worldNormal); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: PhysxRaycastHit::get_distance 00066 // Access: Published 00067 // Description: 00068 //////////////////////////////////////////////////////////////////// 00069 float PhysxRaycastHit:: 00070 get_distance() const { 00071 00072 return _hit.distance; 00073 } 00074