Code Monkey home page Code Monkey logo

Comments (7)

RossNordby avatar RossNordby commented on June 20, 2024 1

The sponsors AI also relied on the newts being around to provide nonzero movement influence; if they reach the final target, there will be a divide by zero. Went ahead and guarded against it in 22dac46.

from bepuphysics2.

0x5143 avatar 0x5143 commented on June 20, 2024

Final I found is postmetric is NaN, because of NaN of child (Max and Min are all NaN) in below code:

struct Tree
{
    unsafe float RefitAndMeasure(ref NodeChild child)
}

from bepuphysics2.

RossNordby avatar RossNordby commented on June 20, 2024

In the CharacterDemo? Could you provide the modified version that reproduces the problem?

from bepuphysics2.

0x5143 avatar 0x5143 commented on June 20, 2024

new 1000 SponsorCharacterAI in Demos.Demos.Characters.CharacterDemo, like below

            const int characterCount = 1000;
            characterAIs = new QuickList<SponsorCharacterAI>(characterCount, BufferPool);
            var characterCollidable = Simulation.Shapes.Add(new Capsule(0.5f, 1f));
            for (int i = 0; i < characterCount; ++i)
            {
                var position2D = newtArenaMin + (newtArenaMax - newtArenaMin) * new Vector2(random.NextSingle(), random.NextSingle());
                var targetPosition = 0.5f * (newtArenaMin + (newtArenaMax - newtArenaMin) * new Vector2(random.NextSingle(), random.NextSingle()));
                characterAIs.AllocateUnsafely() = new SponsorCharacterAI(characterControllers, characterCollidable, new Vector3(position2D.X, 5, position2D.Y), targetPosition);
            }

from bepuphysics2.

RossNordby avatar RossNordby commented on June 20, 2024

Just adding a bunch of characters like that doesn't reproduce a crash after about an hour of idling. Attempting to update them does if there are no newts, because SponsorCharacterAI expects a nonzero number of newts, but that should be a pretty instantaneous crash.

What other changes were made to the CharacterDemo, if any? And is this using the latest master version?

from bepuphysics2.

0x5143 avatar 0x5143 commented on June 20, 2024

Comment code associated with newt like below, and remove spooked condition let it jump sometimes:

            //for (int i = 0; i < newts.Count; ++i)
            //{
            //    ref var newtPosition = ref simulation.Bodies[newts[i].BodyHandle].Pose.Position;
            //    var offset = newtPosition - body.Pose.Position;
            //    var distance = offset.Length();
            //    if (distance > 1e-10f)
            //    {
            //        var influenceMagnitude = 1f / (distance * 0.1f + .1f);
            //        influenceSum -= new Vector2(offset.X, offset.Z) * influenceMagnitude / distance;
            //    }
            //    if (distance < 20)
            //    {
            //        spooked = true;
            //    }
            //}
            ////We want target position relative influence to be consistent regardless of newt count.
            //influenceSum /= newts.Count;

then CharacterAI will move and jump.

I has tested in the master code and v2.4.0, have the same exception.

from bepuphysics2.

0x5143 avatar 0x5143 commented on June 20, 2024

Thanks reply.
I have tested for a long time and not exception, it look work well.

from bepuphysics2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.