H3D API  2.4.1
Collision.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __COLLISION_H__
30 #define __COLLISION_H__
31 
32 #include <H3D/X3DGroupingNode.h>
33 #include <H3D/X3DSensorNode.h>
34 
35 namespace H3D {
112  // According to X3D-spec Collision should inherit from X3DSensorNode
113  // but since this is not allowed (for the database and such) the fields
114  // in common with X3DSensorNode (enabled and isActive)
115  // will just be defined here instead.
116  class H3DAPI_API Collision : public X3DGroupingNode {
117  public:
118 
120 
122  Collision( Inst< AddChildren > _addChildren = 0,
123  Inst< RemoveChildren > _removeChildren = 0,
124  Inst< SFBool > _enabled = 0,
125  Inst< MFChild > _children = 0,
126  Inst< SFNode > _metadata = 0,
127  Inst< SFTime > _collideTime = 0,
128  Inst< SFBool > _isActive = 0,
129  Inst< SFBound > _bound = 0,
130  Inst< SFVec3f > _bboxCenter = 0,
131  Inst< SFVec3f > _bboxSize = 0,
132  Inst< SFChild > _proxy = 0 );
133 
141  virtual bool lineIntersect(
142  const Vec3f &from,
143  const Vec3f &to,
144  LineIntersectResult &result );
145 
152  virtual void closestPoint( const Vec3f &p,
153  NodeIntersectResult &result );
154 
164  virtual bool movingSphereIntersect( H3DFloat radius,
165  const Vec3f &from,
166  const Vec3f &to,
167  NodeIntersectResult &result );
168 
174  H3DUniquePtr< SFTime > collideTime;
175 
184  H3DUniquePtr< SFChild > proxy;
185 
186  // Fields defined to fake this node as a sensor
197  H3DUniquePtr< SFBool > enabled;
198 
206  H3DUniquePtr< SFBool > isActive;
207 
208  static H3DNodeDatabase database;
209  };
210 }
211 
212 #endif
Header file for X3DGroupingNode, X3D scene-graph node.
Header file for X3DSensorNode, X3D scene-graph node.
The Collision node is a grouping node that specifies the collision detection properties for its child...
Definition: Collision.h:116
H3DUniquePtr< SFBool > enabled
The enabled field enables and disables collision detection as well as terrain following (not implemen...
Definition: Collision.h:197
H3DUniquePtr< SFTime > collideTime
The collideTime field generates an event specifying the time when the avatar (see NavigationInfo) mak...
Definition: Collision.h:174
H3DUniquePtr< SFChild > proxy
The collision proxy, defined in the proxy field, is any legal children node as described in 10....
Definition: Collision.h:184
H3DUniquePtr< SFBool > isActive
The value of the isActive field indicates the current state of the Collision node.
Definition: Collision.h:206
Template to make sure that the Node that is set in a SFNode is of a specified Node type.
Definition: SFNode.h:97
This abstract node type indicates that concrete node types derived from it contain children nodes and...
Definition: X3DGroupingNode.h:53
float H3DFloat
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194
Used as input to lineIntersect functions.
Definition: Node.h:224
Used as input to intersection functions.
Definition: Node.h:114