Torque3D Documentation / _generateds / physicsObject.h

physicsObject.h

Engine/source/T3D/physics/physicsObject.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _T3D_PHYSICS_PHYSICSOBJECT_H_
25#define _T3D_PHYSICS_PHYSICSOBJECT_H_
26
27#ifndef _PHYSICS_PHYSICSUSERDATA_H_
28#include "T3D/physics/physicsUserData.h"
29#endif
30#ifndef _UTIL_DELEGATE_H_
31#include "core/util/delegate.h"
32#endif
33#ifndef _REFBASE_H_
34#include "core/util/refBase.h"
35#endif
36
37class PhysicsWorld;
38class MatrixF;
39class Point3F;
40class Box3F;
41
42
43///
44class PhysicsObject : public WeakRefBase 
45{
46public:
47   
48   virtual ~PhysicsObject();
49
50   /// Returns the physics world this object is a member of.
51   virtual PhysicsWorld* getWorld() = 0;
52
53   /// Sets the transform on the physics object.
54   ///
55   /// For static objects this is only intended to be used for
56   /// for infrequent changes when editing the mission.
57   ///
58   virtual void setTransform( const MatrixF &transform ) = 0;
59
60   /// Returns the transform of the physics body at 
61   /// the last processed simulation tick.
62   virtual MatrixF& getTransform( MatrixF *outMatrix ) = 0;
63
64   /// Returns the world aligned bounding box containing the PhysicsObject.
65   virtual Box3F getWorldBounds() = 0;
66
67   /// 
68   void queueCallback( U32 ms, Delegate<void()> callback );
69
70   const PhysicsUserData& getUserData() const { return mUserData; }
71
72   PhysicsUserData& getUserData() { return mUserData; }
73
74   /// Set false to skip simulation of this object or temporarily remove
75   /// it from the physics simulation. Implementation is PhysicsPlugin specific.
76   virtual void setSimulationEnabled( bool enabled ) = 0;
77   virtual bool isSimulationEnabled() = 0;
78
79protected:
80
81   /// You shouldn't be creating this object directly.
82   PhysicsObject();
83
84   /// The user data object assigned to this object.
85   PhysicsUserData mUserData;
86
87   /// The last queued callback event.
88   /// @see queueCallback
89   U32 mQueuedEvent;
90};
91
92#endif // _T3D_PHYSICS_PHYSICSOBJECT_H_
93