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