Panda3D
Loading...
Searching...
No Matches
collisionHandlerPhysical.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 collisionHandlerPhysical.I
10 * @author drose
11 * @date 2002-03-16
12 */
13
14/**
15 * Specifies an arbitrary NodePath that the handler is always considered to be
16 * facing. It does not detect collisions with surfaces that appear to be
17 * facing away from this NodePath. This works best when the collision
18 * surfaces in question are polygons.
19 */
21set_center(const NodePath &center) {
22 _center = center;
23}
24
25/**
26 * Clears the center NodePath specified with set_center.
27 */
30 _center = NodePath();
31}
32
33/**
34 * Returns the NodePath specified with set_center, or the empty NodePath if
35 * nothing has been specified.
36 */
38get_center() const {
39 return _center;
40}
41
42/**
43 * Returns true if a NodePath has been specified with set_center(), false
44 * otherwise.
45 */
47has_center() const {
48 return !_center.is_empty();
49}
50
51/**
52 * Did the handler make any contacts with anything on the last collision pass?
53 * Depending on how your world is setup, this can be used to tell if the
54 * handler is out of the world (i.e. out of bounds). That is the original use
55 * of this call.
56 */
58has_contact() const {
59 return _has_contact;
60}
61
62/**
63 *
64 */
65INLINE void CollisionHandlerPhysical::ColliderDef::
66set_target(const NodePath &target, DriveInterface *drive_interface) {
67 _target = target;
68 _drive_interface = drive_interface;
69}
70
71/**
72 * Called by the handler when it has changed the transform on the target node,
73 * this applies the change to the drive interface if one is specified.
74 */
75INLINE void CollisionHandlerPhysical::ColliderDef::
76updated_transform() {
77 if (_drive_interface != nullptr) {
78 _drive_interface->set_mat(_target.get_mat());
79 _drive_interface->force_dgraph();
80 }
81}
bool has_contact() const
Did the handler make any contacts with anything on the last collision pass? Depending on how your wor...
has_center
Returns true if a NodePath has been specified with set_center(), false otherwise.
clear_center
Clears the center NodePath specified with set_center.
set_center
Specifies an arbitrary NodePath that the handler is always considered to be facing.
get_center
Returns the NodePath specified with set_center, or the empty NodePath if nothing has been specified.
This is a TFormer, similar to Trackball, that moves around a transform matrix in response to mouse in...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
bool is_empty() const
Returns true if the NodePath contains no nodes.
Definition nodePath.I:188