Hi Norbo,
i found an issue in some situation: when i call space.update() i get "Object not set on an instance of the object... try to use new keyword bla bla bla". This error doesn't appear after a specific action on physics, but sometimes appear... probabily in the update routines there's a null not tested i don't know... This happens both in multithreading or single threading scenario.
Ok, this is just to tell you there's this issue!
Thanks.
Fax3D
Issue in 0.10.1
Re: Issue in 0.10.1
Could you copy and paste the exception details? There should be some information about where the exception is occurring in the update. I may also need a reproduction case depending on the exception.
Re: Issue in 0.10.1
Hi Norbo,
this is the detail of the exception...
System.NullReferenceException was unhandled
Message="Riferimento a un oggetto non impostato su un'istanza di oggetto."
Source="BEPUphysics"
StackTrace:
in BEPUphysics.Entities.Entity.applyForces(Single dt, Single timeScale)
in BEPUphysics.Space.applyForcesMultithreadedSubFunction(Object information)
in BEPUphysics.ThreadManager.WorkerThread.threadExecutionLoop()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
InnerException:
Thanks!
this is the detail of the exception...
System.NullReferenceException was unhandled
Message="Riferimento a un oggetto non impostato su un'istanza di oggetto."
Source="BEPUphysics"
StackTrace:
in BEPUphysics.Entities.Entity.applyForces(Single dt, Single timeScale)
in BEPUphysics.Space.applyForcesMultithreadedSubFunction(Object information)
in BEPUphysics.ThreadManager.WorkerThread.threadExecutionLoop()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
InnerException:
Thanks!
Re: Issue in 0.10.1
Make sure that the entity's forces list is not null, and that it contains no null forces. Another possibility is that the entity was somehow removed from the space at a bad time, perhaps because the engine is running asynchronously. This second possibility is very hard to make happen, though.
Re: Issue in 0.10.1
Yeah I am getting the same thing. I am trying to do the GettingStarted tutorial and it crashes when I put in space.update(gameTime);
Re: Issue in 0.10.1
I think that might be a different crash; make sure that the space field of your game is instantiated and not a local variable also called space in your LoadContent method.
For example, the following will throw an exception:
The game's 'space' field is null because the LoadContent's space variable hides the game's variable.
If this isn't the issue, could you copy and paste the detail of the exception you're getting?
For example, the following will throw an exception:
Code: Select all
Space space;
void LoadContent()
{
Space space = new Space();
}
void Update(GameTime gameTime)
{
space.update(gameTime);
}
If this isn't the issue, could you copy and paste the detail of the exception you're getting?
Re: Issue in 0.10.1
Yeah that was my error. So I should put the
Space space = new Space();
into Update then?
Thanks
Space space = new Space();
into Update then?
Thanks
Re: Issue in 0.10.1
Putting it into the Update would create a new, different Space every single frame, which is not what you want.
Instead, you should instantiate the game's space variable. It's very similar to the previous example:
The only difference is that the space referred to by the LoadContent method is the game's space, not a local variable.
Instead, you should instantiate the game's space variable. It's very similar to the previous example:
Code: Select all
Space space;
void LoadContent()
{
space = new Space();
}
void Update(GameTime gameTime)
{
space.update(gameTime);
}