12#ifndef TT_INCLUDE__MOVEABLEPHYSCLASS_H
13#define TT_INCLUDE__MOVEABLEPHYSCLASS_H
15#include "DynamicPhysClass.h"
16#include "MoveablePhysDefClass.h"
17#include "DynamicShadowManager.h"
19class PhysControllerClass;
21class DynTexProjectClass;
22class MoveablePhysClass :
23 public DynamicPhysClass
26 MoveablePhysClass(
void);
27 virtual ~MoveablePhysClass(
void);
28 void Init(
const MoveablePhysDefClass & definition );
29 virtual MoveablePhysClass * As_MoveablePhysClass(
void) {
return this; }
30 const MoveablePhysDefClass * Get_MoveablePhysDef(
void) {
return (MoveablePhysDefClass*)Definition; }
31 virtual void Definition_Changed(
void);
32 virtual bool Needs_Timestep(
void) {
return true; }
33 virtual void Post_Timestep_Process(
void);
34 virtual void Set_Mass(
float mass) { Mass = mass; MassInv = 1.0f / mass; }
35 float Get_Mass(
void) {
return Mass; }
36 float Get_Mass_Inv(
void) {
return MassInv; }
37 virtual void Set_Gravity_Multiplier(
float grav) { GravScale = grav; }
38 float Get_Gravity_Multiplier(
void)
const {
return GravScale; }
39 virtual void Set_Elasticity(
float e) { Elasticity = e; }
40 float Get_Elasticity(
void)
const {
return Elasticity; }
41 virtual void Get_Inertia_Inv(Matrix3 * set_I_inv);
42 virtual bool Can_Teleport(
const Matrix3D &new_tm,
bool check_dyn_only =
false,MultiListClass<PhysClass> * result_list = NULL) {
return false; }
43 virtual bool Can_Teleport_And_Stand(
const Matrix3D &new_tm, Matrix3D *out) { *out = new_tm;
return false; }
44 virtual bool Find_Teleport_Location(
const Vector3 &start,
float radius, Vector3 *out) {
return false; }
45 virtual bool Can_Move_To(
const Matrix3D &new_tm) {
return false; }
46 virtual bool Cinematic_Move_To(
const Matrix3D & new_tm);
47 void Set_Controller(PhysControllerClass * control) { Controller = control; }
48 PhysControllerClass * Get_Controller(
void) {
return Controller; }
49 virtual bool Save (ChunkSaveClass &csave);
50 virtual bool Load (ChunkLoadClass &cload);
51 virtual void On_Post_Load (
void);
52 virtual void Get_Velocity(Vector3 * set_vel)
const = 0;
53 virtual void Set_Velocity(
const Vector3 & newvel) { }
54 virtual void Get_Shadow_Blob_Box(AABoxClass * set_obj_space_box);
55 virtual bool Is_Casting_Shadow(
void) {
return ShadowManager.Is_Casting_Shadow(); }
56 virtual void Link_To_Carrier(PhysClass * carrier,RenderObjClass * carrier_sub_obj = NULL);
57 virtual PhysClass * Peek_Carrier_Object(
void);
58 virtual RenderObjClass * Peek_Carrier_Sub_Object(
void);
64 PhysControllerClass * Controller;
66 RenderObjClass * CarrierSubObject;
67 DynamicShadowManagerClass ShadowManager;
69 MoveablePhysClass(
const MoveablePhysClass &);
70 MoveablePhysClass & operator = (
const MoveablePhysClass &);
72inline void MoveablePhysClass::Get_Inertia_Inv(Matrix3 * set_I_inv)
74 set_I_inv->Make_Identity();
75 (*set_I_inv)[0][0] = MassInv;
76 (*set_I_inv)[1][1] = MassInv;
77 (*set_I_inv)[2][2] = MassInv;