I'm working on a replay system using the character controller sample from the latest bepu physics.
I'm storing 1000 states (the state structure is posted below). I store 1 position each time I call space.Update() and it works almost perfectly.
However, its occasionally throwing the error "Function does not accept floating point Not-a-Number values."
I've attempted to follow other posts involving scaling my world up/down, however nothing I've read has worked.
Here is my stack trace:
Code: Select all
" at System.Math.Sign(Single value)
at BEPUphysics.CollisionShapes.ConvexShapes.CylinderShape.GetLocalExtremePointWithoutMargin(Vector3& direction, Vector3& extremePoint) in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\CollisionShapes\\ConvexShapes\\CylinderShape.cs:line 93
at BEPUphysics.CollisionShapes.ConvexShapes.CylinderShape.GetBoundingBox(RigidTransform& shapeTransform, BoundingBox& boundingBox) in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\CollisionShapes\\ConvexShapes\\CylinderShape.cs:line 53
at BEPUphysics.Collidables.MobileCollidables.ConvexCollidable`1.UpdateBoundingBoxInternal(Single dt) in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\BroadPhaseEntries\\MobileCollidables\\ConvexCollidable.cs:line 86
at BEPUphysics.Collidables.MobileCollidables.EntityCollidable.UpdateBoundingBox(Single dt) in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\BroadPhaseEntries\\MobileCollidables\\EntityCollidable.cs:line 144
at BEPUphysics.OtherSpaceStages.BoundingBoxUpdater.LoopBody(Int32 i) in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\OtherSpaceStages\\BoundingBoxUpdater.cs:line 51
at BEPUphysics.OtherSpaceStages.BoundingBoxUpdater.UpdateSingleThreaded() in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\OtherSpaceStages\\BoundingBoxUpdater.cs:line 83
at BEPUphysics.MultithreadedProcessingStage.Update() in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\MultithreadedProcessingStage.cs:line 59
at BEPUphysics.Space.DoTimeStep() in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\Space.cs:line 495
at BEPUphysics.Space.Update(Single dt) in C:\\Users\\Mike\\Desktop\\bepuReplay\\bepuPhysics\\Space.cs:line 531
at PredictiveBehavior.CLIENT.Update(GameTime gameTime) in C:\\Users\\Mike\\Desktop\\bepuReplay\\PredictiveBehavior\\Client.cs:line 358
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.Run()
at PredictiveBehavior.Program.Main(String[] args) in C:\\Users\\Mike\\Desktop\\bepuReplay\\PredictiveBehavior\\Program.cs:line 14"
Code: Select all
[Serializable]
public struct State
{
public Quaternion Orientation;
public Vector3 Position;
public Vector3 AngularVelocity;
public Vector3 LinearVelocity;
public Vector3 LinearMomentum;
public float Yaw, Pitch;
public static State GetFromCharacterController(CharacterControllerInput controller)
{
var body = controller.CharacterController.Body;
return new State
{
AngularVelocity = body.AngularVelocity,
LinearMomentum = body.LinearMomentum,
LinearVelocity = body.LinearVelocity,
Orientation = body.Orientation,
Position = body.Position,
Yaw = controller.Camera.Yaw,
Pitch = controller.Camera.Pitch,
};
}
public void CopyToCharacterController(ref CharacterControllerInput controller)
{
var body = controller.CharacterController.Body;
body.AngularVelocity = this.AngularVelocity;
body.LinearMomentum = this.LinearMomentum;
body.LinearVelocity = this.LinearVelocity;
body.Orientation = this.Orientation;
body.Position = this.Position;
controller.Camera.Yaw = this.Yaw;
controller.Camera.Pitch = this.Pitch;
}
}
Thanks for any help on the subject,
vendetta