[1378] | 1 | #ifndef NX_COLLISION_NXPLANESHAPE
|
---|
| 2 | #define NX_COLLISION_NXPLANESHAPE
|
---|
| 3 | /*----------------------------------------------------------------------------*\
|
---|
| 4 | |
|
---|
| 5 | | Public Interface to NovodeX Technology
|
---|
| 6 | |
|
---|
| 7 | | www.novodex.com
|
---|
| 8 | |
|
---|
| 9 | \*----------------------------------------------------------------------------*/
|
---|
| 10 | /** \addtogroup physics
|
---|
| 11 | @{
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | #include "Nxp.h"
|
---|
| 15 | #include "NxShape.h"
|
---|
| 16 |
|
---|
| 17 | class NxPlane;
|
---|
| 18 | class NxPlaneShapeDesc;
|
---|
| 19 |
|
---|
| 20 | /**
|
---|
| 21 | \brief A plane collision detection primitive.
|
---|
| 22 |
|
---|
| 23 | By default it is configured to be the y == 0 plane. You can then set a normal and a d to specify
|
---|
| 24 | an arbitrary plane. d is the distance of the plane from the origin along the normal, assuming
|
---|
| 25 | the normal is normalized. Thus the plane equation is:
|
---|
| 26 | normal.x * X + normal.y * Y + normal.z * Z = d
|
---|
| 27 |
|
---|
| 28 | Note: the plane does not represent an infinitely thin object, but rather a completely solid negative
|
---|
| 29 | half space (all points p for which normal.dot(p) - d < 0 are inside the solid region.)
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | Each shape is owned by an actor that it is attached to.
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | <h3>Creation</h3>
|
---|
| 36 |
|
---|
| 37 | An instance can be created by calling the createShape() method of the NxActor object
|
---|
| 38 | that should own it, with a NxPlaneShapeDesc object as the parameter, or by adding the
|
---|
| 39 | shape descriptor into the NxActorDesc class before creating the actor.
|
---|
| 40 |
|
---|
| 41 | The shape is deleted by calling NxActor::releaseShape() on the owning actor.
|
---|
| 42 |
|
---|
| 43 | Example:
|
---|
| 44 |
|
---|
| 45 | \include NxPlaneShape_Create.cpp
|
---|
| 46 |
|
---|
| 47 | <h3>Visualizations</h3>
|
---|
| 48 | \li NX_VISUALIZE_COLLISION_AABBS
|
---|
| 49 | \li NX_VISUALIZE_COLLISION_SHAPES
|
---|
| 50 | \li NX_VISUALIZE_COLLISION_AXES
|
---|
| 51 |
|
---|
| 52 | @see NxActor.createShape() NxPlaneShapeDesc NxShape NxPlane
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | class NxPlaneShape: public NxShape
|
---|
| 56 | {
|
---|
| 57 | public:
|
---|
| 58 |
|
---|
| 59 | /**
|
---|
| 60 | \brief sets the plane equation.
|
---|
| 61 |
|
---|
| 62 | <b>Sleeping:</b> Does <b>NOT</b> wake any actors associated with the shape.
|
---|
| 63 |
|
---|
| 64 | \param[in] normal Normal for the plane, in the global frame. <b>Range:</b> direction vector
|
---|
| 65 | \param[in] d 'd' coefficient of the plane equation. <b>Range:</b> (-inf,inf)
|
---|
| 66 |
|
---|
| 67 | <b>Platform:</b>
|
---|
| 68 | \li PC SW: Yes
|
---|
| 69 | \li PPU : Yes
|
---|
| 70 | \li PS3 : Yes
|
---|
| 71 | \li XB360: Yes
|
---|
| 72 |
|
---|
| 73 | @see getPlane() NxPlane
|
---|
| 74 | */
|
---|
| 75 | virtual void setPlane(const NxVec3 & normal, NxReal d) = 0;
|
---|
| 76 |
|
---|
| 77 | /*
|
---|
| 78 | \brief Saves the state of the shape object to a descriptor.
|
---|
| 79 |
|
---|
| 80 | \param[out] desc Descriptor to save this objects state to.
|
---|
| 81 |
|
---|
| 82 | <b>Platform:</b>
|
---|
| 83 | \li PC SW: Yes
|
---|
| 84 | \li PPU : Yes
|
---|
| 85 | \li PS3 : Yes
|
---|
| 86 | \li XB360: Yes
|
---|
| 87 |
|
---|
| 88 | @see NxPlaneShapeDesc
|
---|
| 89 | */
|
---|
| 90 | virtual void saveToDesc(NxPlaneShapeDesc& desc) const = 0;
|
---|
| 91 |
|
---|
| 92 | /**
|
---|
| 93 | \brief retrieves the plane
|
---|
| 94 |
|
---|
| 95 | \return The description of this plane. See #NxPlane.
|
---|
| 96 |
|
---|
| 97 | <b>Platform:</b>
|
---|
| 98 | \li PC SW: Yes
|
---|
| 99 | \li PPU : Yes
|
---|
| 100 | \li PS3 : Yes
|
---|
| 101 | \li XB360: Yes
|
---|
| 102 |
|
---|
| 103 | @see setPlane NxPlane
|
---|
| 104 | */
|
---|
| 105 | virtual NxPlane getPlane() const = 0;
|
---|
| 106 |
|
---|
| 107 | };
|
---|
| 108 |
|
---|
| 109 | /** @} */
|
---|
| 110 | #endif
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 | //AGCOPYRIGHTBEGIN
|
---|
| 114 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 115 | // Copyright © 2005 AGEIA Technologies.
|
---|
| 116 | // All rights reserved. www.ageia.com
|
---|
| 117 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 118 | //AGCOPYRIGHTEND
|
---|
| 119 |
|
---|