SO3Engine
OgreNewt_ConvexCast.h
Go to the documentation of this file.
1/*
2 OgreNewt Library
3
4 Ogre implementation of Newton Game Dynamics SDK
5
6 OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way.
7
8 by Walaber
9 some changes by melven
10
11*/
12
13#ifndef _INCLUDE_OGRENEWT_CONVEXCAST
14#define _INCLUDE_OGRENEWT_CONVEXCAST
15
16
19
20// OgreNewt namespace. all functions and classes use this namespace.
21namespace OgreNewt
22{
24
27class _OgreNewtExport Convexcast
28{
29public:
30
32 Convexcast();
33
35 virtual ~Convexcast();
36
38
48 void go( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int threadIndex);
49
51
55 virtual bool userPreFilterCallback( OgreNewt::Body* body ) { return true; }
56
57protected:
58
60 NewtonWorldConvexCastReturnInfo *mReturnInfoList;
61
64
67
70
71private:
72
74 static unsigned _CDECL newtonConvexcastPreFilter( const NewtonBody* body, const NewtonCollision* collision, void* userData );
75};
76
77
78
79
81
84class _OgreNewtExport BasicConvexcast : public Convexcast
85{
86public:
88 class _OgreNewtExport ConvexcastContactInfo
89 {
90 public:
91 //Ogre::Real mDistance; //!< dist from point1 of the raycast, in range [0,1].
94 Ogre::Vector3 mContactNormal;
96 Ogre::Vector3 mContactPoint;
98
101 };
102
103
106
108
119 BasicConvexcast( const OgreNewt::World* world, const OgreNewt::ConvexCollisionPtr& col, const Ogre::Vector3& startpt, const Ogre::Quaternion &colori, const Ogre::Vector3& endpt, int maxcontactscount, int threadIndex, OgreNewt::Body* ignoreBody = NULL);
120
123
125 bool userPreFilterCallback( OgreNewt::Body* body );
126
128 void setIgnoreBody( OgreNewt::Body* body ) { mIgnoreBody = body; }
129
131 OgreNewt::Body* getIgnoreBody() { return mIgnoreBody; }
132
133 // ------------------------------------------------------
134 // the following functions can be used to retrieve information about the bodies collided by the convexcast.
135
137 int calculateBodyHitCount() const;
138
140 int getContactsCount() const;
141
143 ConvexcastContactInfo getInfoAt( int hitnum ) const;
144
146 Ogre::Real getDistanceToFirstHit() const;
147
148protected:
151};
152
153
154} // end NAMESPACE OgreNewt
155
156
157
158
159
160#endif // _INCLUDE_OGRENEWT_RAYCAST
161
simple class that represents a single convexcast contact
Ogre::Real mContactPenetration
contact penetration at collision point
dLong mCollisionID
collision ID of the primitive hit by the ray (for compound collision bodies)
Ogre::Vector3 mContactPoint
point of the contact in global space
OgreNewt::Body * mBody
pointer to body intersected with
Ogre::Vector3 mContactNormalOnHitPoint
surface normal at the surface of the hit body
Ogre::Vector3 mContactNormal
normal of intersection.
Basic implementation of the convexcast.
OgreNewt::Body * getIgnoreBody()
return body ignored in filter
void setIgnoreBody(OgreNewt::Body *body)
sets body to ignore in filter
OgreNewt::Body * mIgnoreBody
Body to ignore in filter.
main class for all Rigid Bodies in the system.
represents a collision shape that is explicitly convex.
Ogre::Real mFirstContactDistance
distance in [0,1] to first contact
virtual bool userPreFilterCallback(OgreNewt::Body *body)
user callback pre-filter function.
NewtonWorldConvexCastReturnInfo * mReturnInfoList
list that stores the results of the convex-cast
int mReturnInfoListLength
the real length of the list
int mReturnInfoListSize
the actual maximum length of the list (number of elements memory has been reserved for)
represents a physics world.