Panda3D
Loading...
Searching...
No Matches
collisionSphere.I
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 collisionSphere.I
10 * @author drose
11 * @date 2000-04-24
12 */
13
14/**
15 *
16 */
17INLINE CollisionSphere::
18CollisionSphere(const LPoint3 &center, PN_stdfloat radius) :
19 _center(center), _radius(radius)
20{
21 nassertv(_radius >= 0.0f);
22}
23
24/**
25 *
26 */
27INLINE CollisionSphere::
28CollisionSphere(PN_stdfloat cx, PN_stdfloat cy, PN_stdfloat cz, PN_stdfloat radius) :
29 _center(cx, cy, cz), _radius(radius)
30{
31 nassertv(_radius >= 0.0f);
32}
33
34/**
35 * Creates an invalid sphere. Only used when reading from a bam file.
36 */
37INLINE CollisionSphere::
38CollisionSphere() {
39}
40
41/**
42 *
43 */
44INLINE CollisionSphere::
45CollisionSphere(const CollisionSphere &copy) :
46 CollisionSolid(copy),
47 _center(copy._center),
48 _radius(copy._radius)
49{
50}
51
52/**
53 * Flushes the PStatCollectors used during traversal.
54 */
57 _volume_pcollector.flush_level();
58 _test_pcollector.flush_level();
59}
60
61/**
62 *
63 */
64INLINE void CollisionSphere::
65set_center(const LPoint3 &center) {
66 _center = center;
67 mark_internal_bounds_stale();
68 mark_viz_stale();
69}
70
71/**
72 *
73 */
74INLINE void CollisionSphere::
75set_center(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
76 set_center(LPoint3(x, y, z));
77}
78
79/**
80 *
81 */
82INLINE const LPoint3 &CollisionSphere::
83get_center() const {
84 return _center;
85}
86
87/**
88 *
89 */
90INLINE void CollisionSphere::
91set_radius(PN_stdfloat radius) {
92 nassertv(radius >= 0.0f);
93 _radius = radius;
94 mark_internal_bounds_stale();
95 mark_viz_stale();
96}
97
98/**
99 *
100 */
101INLINE PN_stdfloat CollisionSphere::
102get_radius() const {
103 return _radius;
104}
The abstract base class for all things that can collide with other things in the world,...
A spherical collision volume or object.
static void flush_level()
Flushes the PStatCollectors used during traversal.