|
43 | 43 | /* Native functions */
|
44 | 44 | /* ------------------------------------------------------------------------- */
|
45 | 45 |
|
46 |
| -KX_AddObjectActuator::KX_AddObjectActuator(KX_GameObject *gameobj, |
47 |
| - KX_GameObject *original, |
48 |
| - float time, |
49 |
| - KX_Scene *scene, |
50 |
| - const float *linvel, |
51 |
| - bool linv_local, |
52 |
| - const float *angvel, |
53 |
| - bool angv_local) |
54 |
| - : |
55 |
| - SCA_IActuator(gameobj, KX_ACT_ADD_OBJECT), |
| 46 | +KX_AddObjectActuator::KX_AddObjectActuator(KX_GameObject *gameobj, KX_GameObject *original, float time, KX_Scene* scene, |
| 47 | + const mt::vec3& linvel, bool linv_local, const mt::vec3& angvel, bool angv_local) |
| 48 | + :SCA_IActuator(gameobj, KX_ACT_ADD_OBJECT), |
56 | 49 | m_OriginalObject(original),
|
57 | 50 | m_scene(scene),
|
58 |
| - |
| 51 | + m_linear_velocity(linvel), |
59 | 52 | m_localLinvFlag(linv_local),
|
| 53 | + m_angular_velocity(angvel), |
60 | 54 | m_localAngvFlag(angv_local)
|
61 | 55 | {
|
62 |
| - m_linear_velocity[0] = linvel[0]; |
63 |
| - m_linear_velocity[1] = linvel[1]; |
64 |
| - m_linear_velocity[2] = linvel[2]; |
65 |
| - m_angular_velocity[0] = angvel[0]; |
66 |
| - m_angular_velocity[1] = angvel[1]; |
67 |
| - m_angular_velocity[2] = angvel[2]; |
68 |
| - |
69 | 56 | if (m_OriginalObject) {
|
70 | 57 | m_OriginalObject->RegisterActuator(this);
|
71 | 58 | }
|
@@ -207,9 +194,9 @@ PyAttributeDef KX_AddObjectActuator::Attributes[] = {
|
207 | 194 | EXP_PYATTRIBUTE_RW_FUNCTION("object", KX_AddObjectActuator, pyattr_get_object, pyattr_set_object),
|
208 | 195 | EXP_PYATTRIBUTE_RO_FUNCTION("objectLastCreated", KX_AddObjectActuator, pyattr_get_objectLastCreated),
|
209 | 196 | EXP_PYATTRIBUTE_FLOAT_RW("time", 0.0f, FLT_MAX, KX_AddObjectActuator, m_timeProp),
|
210 |
| - EXP_PYATTRIBUTE_FLOAT_ARRAY_RW("linearVelocity", -FLT_MAX, FLT_MAX, KX_AddObjectActuator, m_linear_velocity, 3), |
211 |
| - EXP_PYATTRIBUTE_FLOAT_ARRAY_RW("angularVelocity", -FLT_MAX, FLT_MAX, KX_AddObjectActuator, m_angular_velocity, 3), |
212 |
| - EXP_PYATTRIBUTE_NULL //Sentinel |
| 197 | + EXP_PYATTRIBUTE_VECTOR_RW("linearVelocity", -FLT_MAX, FLT_MAX, KX_AddObjectActuator, m_linear_velocity, 3), |
| 198 | + EXP_PYATTRIBUTE_VECTOR_RW("angularVelocity", -FLT_MAX, FLT_MAX, KX_AddObjectActuator, m_angular_velocity, 3), |
| 199 | + EXP_PYATTRIBUTE_NULL //Sentinel |
213 | 200 | };
|
214 | 201 |
|
215 | 202 | PyObject *KX_AddObjectActuator::pyattr_get_object(EXP_PyObjectPlus *self, const struct EXP_PYATTRIBUTE_DEF *attrdef)
|
@@ -271,8 +258,8 @@ void KX_AddObjectActuator::InstantAddObject()
|
271 | 258 | // Add an identical object, with properties inherited from the original object
|
272 | 259 | // Now it needs to be added to the current scene.
|
273 | 260 | KX_GameObject *replica = m_scene->AddReplicaObject(m_OriginalObject, static_cast<KX_GameObject *>(GetParent()), m_timeProp);
|
274 |
| - replica->SetLinearVelocity(mt::vec3(m_linear_velocity), m_localLinvFlag); |
275 |
| - replica->SetAngularVelocity(mt::vec3(m_angular_velocity), m_localAngvFlag); |
| 261 | + replica->SetLinearVelocity(m_linear_velocity, m_localLinvFlag); |
| 262 | + replica->SetAngularVelocity(m_angular_velocity, m_localAngvFlag); |
276 | 263 |
|
277 | 264 | // keep a copy of the last object, to allow python scripters to change it
|
278 | 265 | if (m_lastCreatedObject) {
|
|
0 commit comments