Panda3D
Loading...
Searching...
No Matches
bulletClosestHitSweepResult.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file bulletClosestHitSweepResult.cxx
10 * @author enn0x
11 * @date 2010-12-01
12 */
13
15
16/**
17 *
18 */
19BulletClosestHitSweepResult::
20BulletClosestHitSweepResult(const btVector3 &from_pos, const btVector3 &to_pos, const CollideMask &mask)
21 : btCollisionWorld::ClosestConvexResultCallback(from_pos, to_pos), _mask(mask) {
22
23}
24
25/**
26 * Override default implementation.
27 */
29needsCollision(btBroadphaseProxy* proxy0) const {
30
31 btCollisionObject *obj0 = (btCollisionObject *) proxy0->m_clientObject;
32 PandaNode *node0 = (PandaNode *) obj0->getUserPointer();
33 CollideMask mask0 = node0->get_into_collide_mask();
34
35 return (_mask & mask0) != 0;
36}
37
38/**
39 *
40 */
41bool BulletClosestHitSweepResult::
42has_hit() const {
43
44 return hasHit();
45}
46
47/**
48 *
49 */
50PN_stdfloat BulletClosestHitSweepResult::
51get_hit_fraction() const {
52
53 return (PN_stdfloat)m_closestHitFraction;
54}
55
56/**
57 *
58 */
59PandaNode *BulletClosestHitSweepResult::
60get_node() const {
61
62 const btCollisionObject *objectPtr = m_hitCollisionObject;
63 return (objectPtr) ? (PandaNode *)objectPtr->getUserPointer() : nullptr;
64}
65
66/**
67 *
68 */
69LPoint3 BulletClosestHitSweepResult::
70get_hit_pos() const {
71
72 return btVector3_to_LPoint3(m_hitPointWorld);
73}
74
75/**
76 *
77 */
78LVector3 BulletClosestHitSweepResult::
79get_hit_normal() const {
80
81 return btVector3_to_LVector3(m_hitNormalWorld);
82}
83
84/**
85 *
86 */
87LPoint3 BulletClosestHitSweepResult::
88get_from_pos() const {
89
90 return btVector3_to_LPoint3(m_convexFromWorld);
91}
92
93/**
94 *
95 */
96LPoint3 BulletClosestHitSweepResult::
97get_to_pos() const {
98
99 return btVector3_to_LPoint3(m_convexToWorld);
100}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
get_into_collide_mask
Returns the "into" collide mask for this node.
Definition pandaNode.h:264
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Override default implementation.