Trigger not trigged when not walk

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
parapoohda
Posts: 92
Joined: Fri May 31, 2019 6:30 am

Trigger not trigged when not walk

Post by parapoohda » Sun Jan 12, 2020 1:36 pm

When character is not walking it does not trigged trigger. Is this normal? Or I done something wrong.

Norbo
Site Admin
Posts: 4884
Joined: Tue Jul 04, 2006 4:45 am

Re: Trigger not trigged when not walk

Post by Norbo » Sun Jan 12, 2020 5:48 pm

Is the character asleep? Collision detection won't run on sleeping pairs.

You could set the trigger's sleep threshold to -1 to force it to be always active.

parapoohda
Posts: 92
Joined: Fri May 31, 2019 6:30 am

Re: Trigger not trigged when not walk

Post by parapoohda » Tue Jan 14, 2020 5:42 am

Will it make bepu slow? Thank you. :D :D

Um I alway use BodyActivityDescribetion(-1)

I don't know what does it mean thought I just copy it from kinematic in character demo

Code: Select all

var handle = Simulation.Bodies.Add(BodyDescription.CreateKinematic(trigger.StartPosition, collidable, new BodyActivityDescription(-1)));
So it may be another problem

Is it relate to thing I modify in character update goal?

Code: Select all

/* (!characterBody.Awake &&
                    ((character.TryJump && character.Supported) ||
                    newTargetVelocity != character.TargetVelocity ||
                    (newTargetVelocity != Vector2.Zero && character.ViewDirection != viewDirection)))
                {*/
                simulation.Awakener.AwakenBody(character.BodyHandle);
                //}
                character.TargetVelocity = newTargetVelocity;
                character.ViewDirection = viewDirection;
Or it is relate to that I make it stop by update character goal to 0,0

I try to force awaken trigger and character by use

Code: Select all

Simulation.Awakener.AwakenBody(bodyHandle);
but not success.

it seem there are no kinemetic and dynamic pair in configure contact manifold.
Is kinemetic does not collide with stop body?

Should I use dynamic instead.

and make my DemoPoseIntegratorCallbacks

Update:
Sorry _(_ _)_

It not detect walk character
but it send trigger position back incorrectly.
I see it at character but it is infront of character so it need to walk forward to inside trigger.

Norbo
Site Admin
Posts: 4884
Joined: Tue Jul 04, 2006 4:45 am

Re: Trigger not trigged when not walk

Post by Norbo » Tue Jan 14, 2020 8:54 pm

Sounds like you figured it out, but here's some more background information:
Will it make bepu slow?
Probably not! :)

If there are way more triggers than characters, the characters could be the ones perma-active instead.
new BodyActivityDescription(-1)
This just sets the sleep threshold at -1, and since velocity magnitude can't go negative, the object can't go to sleep. It's a perfectly valid way of keeping an object permanently awake.
simulation.Awakener.AwakenBody(character.BodyHandle);
Notably, unconditionally calling this every frame is redundant with setting the character's sleep threshold to a negative value.
Is kinemetic does not collide with stop body?
Sleeping bodies of any type (and statics) will not generate collision tests with each other.

parapoohda
Posts: 92
Joined: Fri May 31, 2019 6:30 am

Re: Trigger not trigged when not walk

Post by parapoohda » Thu Jan 16, 2020 2:38 am

Thank for the information. :D :D

Post Reply