~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_RadarSensor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: KX_RadarSensor.cpp,v 1.4 2004/03/22 22:01:52 jesterking Exp $
 
2
 * $Id: KX_RadarSensor.cpp,v 1.8 2005/03/25 10:33:37 kester Exp $
3
3
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or
31
31
 
32
32
#include "KX_RadarSensor.h"
33
33
#include "KX_GameObject.h"
 
34
#include "PHY_IPhysicsController.h"
34
35
 
35
36
#ifdef HAVE_CONFIG_H
36
37
#include <config.h>
41
42
 */
42
43
KX_RadarSensor::KX_RadarSensor(SCA_EventManager* eventmgr,
43
44
                KX_GameObject* gameobj,
 
45
                PHY_IPhysicsController* physCtrl,
44
46
                        double coneradius,
45
47
                        double coneheight,
46
48
                        int     axis,
54
56
                        : KX_NearSensor(
55
57
                                eventmgr,
56
58
                                gameobj,
57
 
                                DT_NewCone(coneradius,coneheight),
 
59
                                //DT_NewCone(coneradius,coneheight),
58
60
                                margin,
59
61
                                resetmargin,
60
62
                                bFindMaterial,
61
63
                                touchedpropname,
62
64
                                kxscene,
 
65
                                physCtrl,
63
66
                                T),
64
67
                                m_coneradius(coneradius),
65
68
                                m_coneheight(coneheight),
77
80
        
78
81
}
79
82
 
 
83
CValue* KX_RadarSensor::GetReplica()
 
84
{
 
85
        KX_RadarSensor* replica = new KX_RadarSensor(*this);
 
86
        replica->m_colliders = new CListValue();
 
87
        replica->m_bCollision = false;
 
88
        replica->m_bTriggered= false;
 
89
        replica->m_hitObject = NULL;
 
90
        replica->m_bLastTriggered = false;
 
91
        // this will copy properties and so on...
 
92
        CValue::AddDataToReplica(replica);
 
93
        
 
94
        replica->m_client_info = new KX_ClientObjectInfo(m_client_info->m_gameobject, KX_ClientObjectInfo::RADAR);
 
95
        
 
96
        replica->m_physCtrl = replica->m_physCtrl->GetReplica();
 
97
        //todo: make sure replication works fine!
 
98
        //>m_sumoObj = new SM_Object(DT_NewCone(m_coneradius, m_coneheight),NULL,NULL,NULL);
 
99
        //replica->m_sumoObj->setMargin(m_Margin);
 
100
        //replica->m_sumoObj->setClientObject(replica->m_client_info);
 
101
        
 
102
        replica->SynchronizeTransform();
 
103
        
 
104
        return replica;
 
105
}
 
106
 
 
107
 
80
108
/**
81
109
 *      Transforms the collision object. A cone is not correctly centered
82
110
 *      for usage.  */
122
150
        m_cone_origin = trans.getOrigin();
123
151
        m_cone_target = trans(MT_Point3(0, -m_coneheight/2.0 ,0));
124
152
 
125
 
        m_sumoObj->setPosition(trans.getOrigin());
126
 
        m_sumoObj->setOrientation(trans.getRotation());
127
 
        m_sumoObj->calcXform();
 
153
 
 
154
        m_physCtrl->setPosition(trans.getOrigin().x(),trans.getOrigin().y(),trans.getOrigin().z());
 
155
        m_physCtrl->setOrientation(trans.getRotation().x(),trans.getRotation().y(),trans.getRotation().z(),trans.getRotation().w());
 
156
        m_physCtrl->calcXform();
 
157
 
128
158
}
129
159
 
130
160
/* ------------------------------------------------------------------------- */
171
201
        {NULL,NULL,NULL,NULL} //Sentinel
172
202
};
173
203
 
174
 
PyObject* KX_RadarSensor::_getattr(char* attr) {
 
204
PyObject* KX_RadarSensor::_getattr(const STR_String& attr) {
175
205
        _getattr_up(KX_TouchSensor);
176
206
}
177
207