forked from bartvdbraak/blender
BGE: Fix for issue #32606 "Raycasts are locked to the scene of calling object" reported by Josiah Lane (solarlune). The raycasting functions were using the active scene instead of the object's scene.
This commit is contained in:
parent
1a8dcbcb4f
commit
8997e5ae06
@ -1400,6 +1400,14 @@ CListValue* KX_GameObject::GetChildrenRecursive()
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KX_Scene* KX_GameObject::GetScene()
|
||||||
|
{
|
||||||
|
SG_Node* node = this->GetSGNode();
|
||||||
|
KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
|
||||||
|
|
||||||
|
return scene;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* Some stuff taken from the header
|
* Some stuff taken from the header
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
@ -1754,8 +1762,7 @@ PyObject *KX_GameObject::PyReplaceMesh(PyObject *args)
|
|||||||
|
|
||||||
PyObject *KX_GameObject::PyEndObject()
|
PyObject *KX_GameObject::PyEndObject()
|
||||||
{
|
{
|
||||||
SG_Node* node = this->GetSGNode();
|
KX_Scene* scene = GetScene();
|
||||||
KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
|
|
||||||
|
|
||||||
scene->DelayedRemoveObject(this);
|
scene->DelayedRemoveObject(this);
|
||||||
|
|
||||||
@ -2003,8 +2010,7 @@ PyObject *KX_GameObject::pyattr_get_group_members(void *self_v, const KX_PYATTRI
|
|||||||
PyObject* KX_GameObject::pyattr_get_scene(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
PyObject* KX_GameObject::pyattr_get_scene(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
{
|
{
|
||||||
KX_GameObject *self = static_cast<KX_GameObject*>(self_v);
|
KX_GameObject *self = static_cast<KX_GameObject*>(self_v);
|
||||||
SG_Node *node = self->GetSGNode();
|
KX_Scene *scene = self->GetScene();
|
||||||
KX_Scene *scene = static_cast<KX_Scene *>(node->GetSGClientInfo());
|
|
||||||
if (scene) {
|
if (scene) {
|
||||||
return scene->GetProxy();
|
return scene->GetProxy();
|
||||||
}
|
}
|
||||||
@ -3056,7 +3062,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
|
|||||||
if (dist != 0.0f)
|
if (dist != 0.0f)
|
||||||
toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
|
toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
|
||||||
|
|
||||||
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
|
PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
|
||||||
KX_IPhysicsController *spc = GetPhysicsController();
|
KX_IPhysicsController *spc = GetPhysicsController();
|
||||||
KX_GameObject *parent = GetParent();
|
KX_GameObject *parent = GetParent();
|
||||||
if (!spc && parent)
|
if (!spc && parent)
|
||||||
@ -3202,7 +3208,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
|
|||||||
return none_tuple_3();
|
return none_tuple_3();
|
||||||
}
|
}
|
||||||
|
|
||||||
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
|
PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
|
||||||
KX_IPhysicsController *spc = GetPhysicsController();
|
KX_IPhysicsController *spc = GetPhysicsController();
|
||||||
KX_GameObject *parent = GetParent();
|
KX_GameObject *parent = GetParent();
|
||||||
if (!spc && parent)
|
if (!spc && parent)
|
||||||
|
@ -923,6 +923,8 @@ public:
|
|||||||
CListValue* GetChildren();
|
CListValue* GetChildren();
|
||||||
CListValue* GetChildrenRecursive();
|
CListValue* GetChildrenRecursive();
|
||||||
|
|
||||||
|
KX_Scene* GetScene();
|
||||||
|
|
||||||
#ifdef WITH_PYTHON
|
#ifdef WITH_PYTHON
|
||||||
/**
|
/**
|
||||||
* \section Python interface functions.
|
* \section Python interface functions.
|
||||||
|
Loading…
Reference in New Issue
Block a user