synched with trunk at revision 36569
[blender.git] / source / gameengine / Ketsji / KX_GameObject.h
1 /*
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program 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 this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28  */
29
30 /** \file KX_GameObject.h
31  *  \ingroup ketsji
32  *  \brief General KX game object.
33  */
34
35 #ifndef __KX_GAMEOBJECT
36 #define __KX_GAMEOBJECT
37
38 #if defined(WIN32) && !defined(FREE_WINDOWS)
39 // get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo
40 #pragma warning (disable : 4355) 
41 #endif 
42
43 #include <stddef.h>
44
45 #include "ListValue.h"
46 #include "SCA_IObject.h"
47 #include "SG_Node.h"
48 #include "MT_Transform.h"
49 #include "MT_CmMatrix4x4.h"
50 #include "CTR_Map.h"
51 #include "CTR_HashedPtr.h"
52 #include "KX_Scene.h"
53 #include "KX_KetsjiEngine.h" /* for m_anim_framerate */
54 #include "KX_IPhysicsController.h" /* for suspend/resume */
55 #include "DNA_object_types.h"
56 #include "SCA_LogicManager.h" /* for ConvertPythonToGameObject to search object names */
57 #define KX_OB_DYNAMIC 1
58
59 //Forward declarations.
60 struct KX_ClientObjectInfo;
61 class KX_RayCast;
62 class RAS_MeshObject;
63 class KX_IPhysicsController;
64 class PHY_IGraphicController;
65 class PHY_IPhysicsEnvironment;
66 struct Object;
67 class KX_ObstacleSimulation;
68
69 #ifdef WITH_PYTHON
70 /* utility conversion function */
71 bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix);
72 #endif
73
74 #ifdef USE_MATHUTILS
75 void KX_GameObject_Mathutils_Callback_Init(void);
76 #endif
77
78 /**
79  * KX_GameObject is the main class for dynamic objects.
80  */
81 class KX_GameObject : public SCA_IObject
82 {
83         Py_Header;
84 protected:
85
86         bool                                                            m_bDyna;
87         KX_ClientObjectInfo*                            m_pClient_info;
88         STR_String                                                      m_name;
89         STR_String                                                      m_text;
90         int                                                                     m_layer;
91         std::vector<RAS_MeshObject*>            m_meshes;
92         SG_QList                                                        m_meshSlots;    // head of mesh slots of this 
93         struct Object*                                          m_pBlenderObject;
94         struct Object*                                          m_pBlenderGroupObject;
95         
96         bool                                                            m_bSuspendDynamics;
97         bool                                                            m_bUseObjectColor;
98         bool                                                            m_bIsNegativeScaling;
99         MT_Vector4                                                      m_objectColor;
100
101         // visible = user setting
102         // culled = while rendering, depending on camera
103         bool                                                            m_bVisible; 
104         bool                                                            m_bCulled; 
105         bool                                                            m_bOccluder;
106
107         KX_IPhysicsController*                          m_pPhysicsController1;
108         PHY_IGraphicController*                         m_pGraphicController;
109         STR_String                                                      m_testPropName;
110         bool                                                            m_xray;
111         KX_GameObject*                                          m_pHitObject;
112
113         SG_Node*                                                        m_pSGNode;
114
115         MT_CmMatrix4x4                                          m_OpenGL_4x4Matrix;
116
117         KX_ObstacleSimulation*                          m_pObstacleSimulation;
118
119 public:
120         bool                                                            m_isDeformable;
121
122         /**
123          * Helper function for modules that can't include KX_ClientObjectInfo.h
124          */
125         static KX_GameObject* GetClientObject(KX_ClientObjectInfo* info);
126
127 #ifdef WITH_PYTHON
128         // Python attributes that wont convert into CValue
129         // 
130         // there are 2 places attributes can be stored, in the CValue,
131         // where attributes are converted into BGE's CValue types
132         // these can be used with property actuators
133         //
134         // For the python API, For types that cannot be converted into CValues (lists, dicts, GameObjects)
135         // these will be put into "m_attr_dict", logic bricks cannot access them.
136         // 
137         // rules for setting attributes.
138         // 
139         // * there should NEVER be a CValue and a m_attr_dict attribute with matching names. get/sets make sure of this.
140         // * if CValue conversion fails, use a PyObject in "m_attr_dict"
141         // * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue
142         // 
143         PyObject*                                                       m_attr_dict; 
144 #endif
145
146         virtual void    /* This function should be virtual - derived classed override it */
147         Relink(
148                 CTR_Map<CTR_HashedPtr, void*> *map
149         );
150
151         /**
152          * Compute an OpenGl compatable 4x4 matrix. Has the
153          * side effect of storing the result internally. The
154          * memory for the matrix remains the property of this class.
155          */ 
156                 double*                                         
157         GetOpenGLMatrix(
158         );
159
160         /**
161          * Return a pointer to a MT_CmMatrix4x4 storing the 
162          * opengl transformation for this object. This is updated
163          * by a call to GetOpenGLMatrix(). This class owns the 
164          * memory for the returned matrix.
165          */
166
167                 MT_CmMatrix4x4*                         
168         GetOpenGLMatrixPtr(
169         ) { 
170                 return &m_OpenGL_4x4Matrix;
171         };
172
173         /**
174          * Update the blender object obmat field from the object world position
175          * if blendobj is NULL, update the object pointed by m_pBlenderObject
176          * The user must take action to restore the matrix before leaving the GE.
177          * Used in Armature evaluation
178          */
179                 void
180         UpdateBlenderObjectMatrix(Object* blendobj=NULL);
181
182         /** 
183          * Get a pointer to the game object that is the parent of 
184          * this object. Or NULL if there is no parent. The returned
185          * object is part of a reference counting scheme. Calling
186          * this function ups the reference count on the returned 
187          * object. It is the responsibility of the caller to decrement
188          * the reference count when you have finished with it.
189          */
190                 KX_GameObject*                          
191         GetParent(
192         );
193
194         /** 
195          * Sets the parent of this object to a game object
196          */                     
197         void SetParent(KX_Scene *scene, KX_GameObject *obj, bool addToCompound=true, bool ghost=true);
198
199         /** 
200          * Removes the parent of this object to a game object
201          */                     
202         void RemoveParent(KX_Scene *scene);
203
204         /**
205          * Construct a game object. This class also inherits the 
206          * default constructors - use those with care!
207          */
208
209         KX_GameObject(
210                 void* sgReplicationInfo,
211                 SG_Callbacks callbacks
212         );
213
214         virtual 
215         ~KX_GameObject(
216         );
217
218         /** 
219          * @section Stuff which is here due to poor design.
220          * Inherited from CValue and needs an implementation. 
221          * Do not expect these functions do to anything sensible.
222          */
223
224         /**
225          * Inherited from CValue -- does nothing!
226          */
227                 CValue*                         
228         Calc(
229                 VALUE_OPERATOR op,
230                 CValue *val
231         );
232
233         /**
234          * Inherited from CValue -- does nothing!
235          */
236                 CValue*                         
237         CalcFinal(
238                 VALUE_DATA_TYPE dtype,
239                 VALUE_OPERATOR op,
240                 CValue *val
241         );
242
243         /**
244          * Inherited from CValue -- does nothing!
245          */
246         const 
247                 STR_String &    
248         GetText(
249         );
250
251         /**
252          * Inherited from CValue -- does nothing!
253          */
254                 double
255         GetNumber(
256         );
257
258         /**
259          * @section Inherited from CValue. These are the useful
260          * part of the CValue interface that this class implements. 
261          */
262
263         /**
264          * Inherited from CValue -- returns the name of this object.
265          */
266                 STR_String&                     
267         GetName(
268         );
269
270         /**
271          * Inherited from CValue -- set the name of this object.
272          */
273                 void                            
274         SetName(
275                 const char *name
276         );
277
278         /** 
279          * Inherited from CValue -- return a new copy of this
280          * instance allocated on the heap. Ownership of the new 
281          * object belongs with the caller.
282          */
283         virtual CValue*                         
284         GetReplica(
285         );
286         
287         /**
288          * Inherited from CValue -- Makes sure any internal 
289          * data owned by this class is deep copied. Called internally
290          */
291         virtual void                            
292         ProcessReplica();
293
294         /** 
295          * Return the linear velocity of the game object.
296          */
297                 MT_Vector3 
298         GetLinearVelocity(
299                 bool local=false
300         );
301
302         /** 
303          * Return the linear velocity of a given point in world coordinate
304          * but relative to center of object ([0,0,0]=center of object)
305          */
306                 MT_Vector3 
307         GetVelocity(
308                 const MT_Point3& position
309         );
310
311         /**
312          * Return the mass of the object
313          */
314                 MT_Scalar       
315         GetMass();
316
317         /**
318          * Return the local inertia vector of the object
319          */
320                 MT_Vector3
321         GetLocalInertia();
322
323         /** 
324          * Return the angular velocity of the game object.
325          */
326                 MT_Vector3 
327         GetAngularVelocity(
328                 bool local=false
329         );
330
331         /** 
332          * Align the object to a given normal.
333          */
334                 void 
335         AlignAxisToVect(
336                 const MT_Vector3& vect,
337                 int axis = 2,
338                 float fac = 1.0
339         );
340
341         /** 
342          * Quick'n'dirty obcolor ipo stuff
343          */
344
345                 void                            
346         SetObjectColor(
347                 const MT_Vector4& rgbavec
348         );
349
350                 const MT_Vector4&
351         GetObjectColor();
352
353
354                 void 
355         ResolveCombinedVelocities(
356                 const MT_Vector3 & lin_vel,
357                 const MT_Vector3 & ang_vel,
358                 bool lin_vel_local,
359                 bool ang_vel_local
360         );
361
362         /**
363          * @return a pointer to the physics controller owned by this class.
364          */
365
366         KX_IPhysicsController* GetPhysicsController() ;
367
368         void    SetPhysicsController(KX_IPhysicsController*     physicscontroller,bool isDynamic) 
369         { 
370                 m_bDyna = isDynamic;
371                 m_pPhysicsController1 = physicscontroller;
372         }
373
374         virtual class RAS_Deformer* GetDeformer()
375         {
376                 return 0;
377         }
378         virtual void    SetDeformer(class RAS_Deformer* deformer)
379         {
380
381         }
382
383         /**
384          * @return a pointer to the graphic controller owner by this class 
385          */
386         PHY_IGraphicController* GetGraphicController()
387         {
388                 return m_pGraphicController;
389         }
390
391         void SetGraphicController(PHY_IGraphicController* graphiccontroller) 
392         { 
393                 m_pGraphicController = graphiccontroller;
394         }
395         /*
396          * @add/remove the graphic controller to the physic system
397          */
398         void ActivateGraphicController(bool recurse);
399
400         /**
401          * @section Coordinate system manipulation functions
402          */
403
404         void    NodeSetLocalPosition(const MT_Point3& trans     );
405
406         void    NodeSetLocalOrientation(const MT_Matrix3x3& rot );
407         void    NodeSetGlobalOrientation(const MT_Matrix3x3& rot        );
408
409         void    NodeSetLocalScale(      const MT_Vector3& scale );
410
411         void    NodeSetRelativeScale(   const MT_Vector3& scale );
412
413         // adapt local position so that world position is set to desired position
414         void    NodeSetWorldPosition(const MT_Point3& trans);
415
416                 void                                            
417         NodeUpdateGS(
418                 double time
419         );
420
421         const MT_Matrix3x3& NodeGetWorldOrientation(  ) const;
422         const MT_Vector3& NodeGetWorldScaling(  ) const;
423         const MT_Point3& NodeGetWorldPosition(  ) const;
424
425         const MT_Matrix3x3& NodeGetLocalOrientation(  ) const;
426         const MT_Vector3& NodeGetLocalScaling(  ) const;
427         const MT_Point3& NodeGetLocalPosition(  ) const;
428
429         /**
430          * @section scene graph node accessor functions.
431          */
432
433         SG_Node*        GetSGNode(      ) 
434         { 
435                 return m_pSGNode;
436         }
437
438         const   SG_Node* GetSGNode(     ) const 
439         { 
440                 return m_pSGNode;
441         }
442
443         /**
444          * @section blender object accessor functions.
445          */
446
447         struct Object* GetBlenderObject( )
448         {
449                 return m_pBlenderObject;
450         }
451
452         void SetBlenderObject( struct Object* obj)
453         {
454                 m_pBlenderObject = obj;
455         }
456
457         struct Object* GetBlenderGroupObject( )
458         {
459                 return m_pBlenderGroupObject;
460         }
461
462         void SetBlenderGroupObject( struct Object* obj)
463         {
464                 m_pBlenderGroupObject = obj;
465         }
466         
467         bool IsDupliGroup()
468         { 
469                 return (m_pBlenderObject &&
470                                 (m_pBlenderObject->transflag & OB_DUPLIGROUP) &&
471                                 m_pBlenderObject->dup_group != NULL) ? true : false;
472         }
473
474         /**
475          * Set the Scene graph node for this game object.
476          * warning - it is your responsibility to make sure
477          * all controllers look at this new node. You must
478          * also take care of the memory associated with the
479          * old node. This class takes ownership of the new
480          * node.
481          */
482                 void    SetSGNode(SG_Node* node )
483                 { 
484                         m_pSGNode = node; 
485                 }
486         
487         //Is it a dynamic/physics object ?
488         bool    IsDynamic() const 
489         { 
490                 return m_bDyna; 
491         }
492
493         /**
494          * Check if this object has a vertex parent relationship
495          */
496         bool IsVertexParent( )
497         {
498                 return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent());
499         }
500
501         bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
502         bool NeedRayCast(KX_ClientObjectInfo* client);
503
504
505         /**
506          * @section Physics accessors for this node.
507          *
508          * All these calls get passed directly to the physics controller 
509          * owned by this object.
510          * This is real interface bloat. Why not just use the physics controller
511          * directly? I think this is because the python interface is in the wrong
512          * place.
513          */
514
515                 void                                            
516         ApplyForce(
517                 const MT_Vector3& force,        bool local
518         );
519
520                 void                                            
521         ApplyTorque(
522                 const MT_Vector3& torque,
523                 bool local
524         );
525
526                 void                                            
527         ApplyRotation(
528                 const MT_Vector3& drot,
529                 bool local
530         );
531
532                 void                                            
533         ApplyMovement(
534                 const MT_Vector3& dloc,
535                 bool local
536         );
537
538                 void                                            
539         addLinearVelocity(
540                 const MT_Vector3& lin_vel,
541                 bool local
542         );
543
544                 void                                            
545         setLinearVelocity(
546                 const MT_Vector3& lin_vel,
547                 bool local
548         );
549
550                 void                                            
551         setAngularVelocity(
552                 const MT_Vector3& ang_vel,
553                 bool local
554         );
555
556         /**     
557          * Update the physics object transform based upon the current SG_Node
558          * position.
559          */
560                 void
561         UpdateTransform(
562         );
563
564         static void UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene);
565
566         /**
567          * only used for sensor objects
568          */
569         void SynchronizeTransform();
570
571         static void SynchronizeTransformFunc(SG_IObject* node, void* gameobj, void* scene);
572
573         /**
574          * Function to set IPO option at start of IPO
575          */ 
576                 void    
577         InitIPO(
578                 bool ipo_as_force,
579                 bool ipo_add,
580                 bool ipo_local
581         );
582
583         /**
584          * Odd function to update an ipo. ???
585          */ 
586                 void    
587         UpdateIPO(
588                 float curframetime,
589                 bool recurse
590         );
591         /**
592          * Updates Material Ipo data 
593          */
594                 void 
595         UpdateMaterialData(
596                 dword matname_hash,
597                 MT_Vector4 rgba,
598                 MT_Vector3 specrgb,
599                 MT_Scalar hard,
600                 MT_Scalar spec,
601                 MT_Scalar ref,
602                 MT_Scalar emit,
603                 MT_Scalar alpha
604         );
605
606         /**
607          * @section Mesh accessor functions.
608          */
609
610         /**     
611          * Update buckets to indicate that there is a new
612          * user of this object's meshes.
613          */
614                 void                                            
615         AddMeshUser(
616         );
617         
618         /**     
619          * Update buckets with data about the mesh after
620          * creating or duplicating the object, changing
621          * visibility, object color, .. .
622          */
623                 void                                            
624         UpdateBuckets(
625                 bool recursive
626         );
627
628         /**
629          * Clear the meshes associated with this class
630          * and remove from the bucketing system.
631          * Don't think this actually deletes any of the meshes.
632          */
633                 void                                            
634         RemoveMeshes(
635         );
636
637         /**
638          * Add a mesh to the set of meshes associated with this
639          * node. Meshes added in this way are not deleted by this class.
640          * Make sure you call RemoveMeshes() before deleting the
641          * mesh though,
642          */
643                 void                                            
644         AddMesh(
645                 RAS_MeshObject* mesh
646         ){ 
647                 m_meshes.push_back(mesh);
648         }
649
650         /**
651          * Pick out a mesh associated with the integer 'num'.
652          */
653                 RAS_MeshObject*                         
654         GetMesh(
655                 int num
656         ) const { 
657                 return m_meshes[num]; 
658         }
659
660         /**
661          * Return the number of meshes currently associated with this
662          * game object.
663          */
664                 int                                                     
665         GetMeshCount(
666         ) const { 
667                 return m_meshes.size(); 
668         }
669         
670         /**     
671          * Set the debug color of the meshes associated with this
672          * class. Does this still work?
673          */
674                 void                                            
675         SetDebugColor(
676                 unsigned int bgra
677         );
678
679         /** 
680          * Reset the debug color of meshes associated with this class.
681          */
682                 void                                            
683         ResetDebugColor(
684         );
685
686         /**
687          * Was this object marked visible? (only for the explicit
688          * visibility system).
689          */
690                 bool
691         GetVisible(
692                 void
693         );
694
695         /**
696          * Set visibility flag of this object
697          */
698                 void
699         SetVisible(
700                 bool b,
701                 bool recursive
702         );
703
704         /**
705          * Was this object culled?
706          */
707         inline bool
708         GetCulled(
709                 void
710         ) { return m_bCulled; }
711
712         /**
713          * Set culled flag of this object
714          */
715         inline void
716         SetCulled(
717                 bool c
718         ) { m_bCulled = c; }
719         
720         /**
721          * Is this object an occluder?
722          */
723         inline bool
724         GetOccluder(
725                 void
726         ) { return m_bOccluder; }
727
728         /**
729          * Set occluder flag of this object
730          */
731         void
732         SetOccluder(
733                 bool v,
734                 bool recursive
735         );
736         
737         /**
738          * Change the layer of the object (when it is added in another layer
739          * than the original layer)
740          */
741                 void
742         SetLayer(
743                 int l
744         );
745
746         /**
747          * Get the object layer
748          */
749                 int
750         GetLayer(
751                 void
752         );
753                 
754         /**
755          * Get the negative scaling state
756          */
757                 bool
758         IsNegativeScaling(
759                 void
760         ) { return m_bIsNegativeScaling; }
761
762         /**
763          * @section Logic bubbling methods.
764          */
765
766         /**
767          * Stop making progress
768          */
769         void Suspend(void);
770
771         /**
772          * Resume making progress
773          */
774         void Resume(void);
775         
776         void SuspendDynamics(void) {
777                 if (m_bSuspendDynamics)
778                 {
779                         return;
780                 }
781         
782                 if (m_pPhysicsController1)
783                 {
784                         m_pPhysicsController1->SuspendDynamics();
785                 }
786                 m_bSuspendDynamics = true;
787         }
788         
789         void RestoreDynamics(void) {    
790                 if (!m_bSuspendDynamics)
791                 {
792                         return;
793                 }
794         
795                 if (m_pPhysicsController1)
796                 {
797                         m_pPhysicsController1->RestoreDynamics();
798                 }
799                 m_bSuspendDynamics = false;
800         }
801
802         void RegisterObstacle(KX_ObstacleSimulation* obstacleSimulation)
803         {
804                 m_pObstacleSimulation = obstacleSimulation;
805         }
806
807         void UnregisterObstacle()
808         {
809                 m_pObstacleSimulation = NULL;
810         }
811         
812         KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
813         
814         CListValue* GetChildren();
815         CListValue* GetChildrenRecursive();
816
817 #ifdef WITH_PYTHON
818         /**
819          * @section Python interface functions.
820          */
821         virtual PyObject* py_repr(void)
822         {
823                 return PyUnicode_FromString(GetName().ReadPtr());
824         }
825
826         KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
827         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
828         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
829         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation);
830         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement);
831         KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
832         KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
833         KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
834         KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity);
835         KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity);
836
837         KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce);
838
839
840         KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible);
841         KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible);
842         KX_PYMETHOD_VARARGS(KX_GameObject,SetOcclusion);
843         KX_PYMETHOD_NOARGS(KX_GameObject,GetState);
844         KX_PYMETHOD_O(KX_GameObject,SetState);
845         KX_PYMETHOD_VARARGS(KX_GameObject,AlignAxisToVect);
846         KX_PYMETHOD_O(KX_GameObject,GetAxisVect);
847         KX_PYMETHOD_NOARGS(KX_GameObject,SuspendDynamics);
848         KX_PYMETHOD_NOARGS(KX_GameObject,RestoreDynamics);
849         KX_PYMETHOD_NOARGS(KX_GameObject,EnableRigidBody);
850         KX_PYMETHOD_NOARGS(KX_GameObject,DisableRigidBody);
851         KX_PYMETHOD_VARARGS(KX_GameObject,ApplyImpulse);
852         KX_PYMETHOD_O(KX_GameObject,SetCollisionMargin);
853         KX_PYMETHOD_NOARGS(KX_GameObject,GetParent);
854         KX_PYMETHOD_VARARGS(KX_GameObject,SetParent);
855         KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent);
856         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);
857         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive);
858         KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh);
859         KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId);
860         KX_PYMETHOD_NOARGS(KX_GameObject,GetPropertyNames);
861         KX_PYMETHOD_VARARGS(KX_GameObject,ReplaceMesh);
862         KX_PYMETHOD_NOARGS(KX_GameObject,EndObject);
863         KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
864         KX_PYMETHOD_DOC(KX_GameObject,rayCast);
865         KX_PYMETHOD_DOC_O(KX_GameObject,getDistanceTo);
866         KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo);
867         KX_PYMETHOD_DOC_VARARGS(KX_GameObject, sendMessage);
868         KX_PYMETHOD_VARARGS(KX_GameObject, ReinstancePhysicsMesh);
869         
870         /* Dict access */
871         KX_PYMETHOD_VARARGS(KX_GameObject,get);
872         
873         /* attributes */
874         static PyObject*        pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
875         static PyObject*        pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
876
877         static PyObject*        pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
878         static PyObject*        pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
879         static int                      pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
880         static PyObject*        pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
881         static int                      pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
882         static PyObject*        pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
883         static int                      pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
884         static PyObject*        pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
885         static int                      pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
886         static PyObject*        pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
887         static int                      pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
888         static PyObject*        pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
889         static int                      pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
890         static PyObject*        pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
891         static int                      pyattr_set_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
892         static PyObject*        pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
893         static int                      pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
894         static PyObject*        pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
895         static int                      pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
896         static PyObject*        pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
897         static PyObject*        pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
898         static int                      pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
899         static PyObject*        pyattr_get_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
900         static int                      pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
901         static PyObject*        pyattr_get_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
902         static int                      pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
903         static PyObject*        pyattr_get_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
904         static int                      pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
905         static PyObject*        pyattr_get_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
906         static int                      pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);      
907         static PyObject*        pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
908         static int                      pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
909         static PyObject*        pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
910         static int                      pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
911         static PyObject*        pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
912         static PyObject*        pyattr_get_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
913         static PyObject*        pyattr_get_children_recursive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
914         static PyObject*        pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
915         static PyObject*        pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef);
916         static int                      pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
917         
918         /* Experemental! */
919         static PyObject*        pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
920         static PyObject*        pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
921         static PyObject*        pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
922         
923         /* getitem/setitem */
924         static PyMappingMethods Mapping;
925         static PySequenceMethods        Sequence;
926 #endif
927 };
928
929
930
931 #endif //__KX_GAMEOBJECT
932