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