Robert Isele
22-03-2006 02:49:38
Hi,
there's a bug in the property MovableObject.UserData:
If you retrieve a moveableObject with SceneNode.GetAttachedObject(i), its UserData property is 'null', even if you've assigned some value to it before. For this reason the following code won't work as expected:
The root of this problem is the way GetAttachedObject works: It always returns a new instance of MovableObject, hence its userData-member is initialized with null.
there's a bug in the property MovableObject.UserData:
public object UserData
{
get{return _userData;}
set{_userData = value;}
}
private object _userData;
If you retrieve a moveableObject with SceneNode.GetAttachedObject(i), its UserData property is 'null', even if you've assigned some value to it before. For this reason the following code won't work as expected:
entity.UserData = someObject;
sceneNode.AttachObject(entity);
Object o = sceneNode.GetAttachedObject(0).UserData;
//o == null
The root of this problem is the way GetAttachedObject works: It always returns a new instance of MovableObject, hence its userData-member is initialized with null.
public virtual MovableObject GetAttachedObject(UInt16 index)
{
IntPtr cPtr = OgreBindingsPINVOKE.SceneNode_GetAttachedObject__SWIG_0(swigCPtr, (UInt16)index);
MovableObject ret = (cPtr == IntPtr.Zero) ? null : new MovableObject(cPtr, false);
return ret;
}