A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Julio Jerez » Tue Apr 09, 2019 10:51 am
tell me something what is it that when teh player collide wit the box you call this funtion
void NewtonBodySetSleepState(const NewtonBody* const bodyPtr, int state)
what kind of object is the player.
what Dave predicated is correct, the box is getting some velocity from the player that is overtaking the gravity and every thing the make a body move by gravity.
before was setting the matrix, then setting the zero impulse, now is just calling SetSleepState
non of wich should be part of a simulation cycle.
the player sould be able to active the body.
please tell what kind of object is your player.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Tue Apr 09, 2019 11:10 am
I see the body is kinematic and kinematic bodies do not active dynamics bodies. or at least I think that's the case.
anyway I think I have the solution but I do not have more time now.
I will fix it later.
basically the put to sleep should invalidate the contact joints on that body so that is recalculated wi teh correct penetration each time. That sould fix for real for everything.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Tue Apr 09, 2019 1:50 pm
Ok, I committed a repro that produce the bug, now I can debug and fixed.
calling NewtonBodySetSleepState(body, 0); on ever frame make I happens.
which is what you are doing one way of another.
I have the solution but is not in yet, I need to see if it will cause side effects.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Tue Apr 09, 2019 2:06 pm
Ok if you sync latest it should be fixed now.
you do not need to do anything is should just work.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by JoshKlint » Tue Apr 09, 2019 9:53 pm
It seems to be working now. I put an engine update out on Steam.
The reason SetSleepState() is called is to wake up an object any time an external force is applied to it.
-
JoshKlint
-
- Posts: 163
- Joined: Sun Dec 10, 2017 8:03 pm
-
by JernejL » Wed Apr 10, 2019 3:03 am
JoshKlint wrote:It seems to be working now. I put an engine update out on Steam.
The reason SetSleepState() is called is to wake up an object any time an external force is applied to it.
Why is this neccesary? like i write before, my understanding is, that the callback is called for each body regardless of sleep state and newton will automaticly wake up bodies if you apply force or torque there.
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Dave Gravel » Wed Apr 10, 2019 4:02 am
JernejL I think it is because the body is kinematic.
The sleep don't behave the same with kinematic body.
Maybe for speed reason it is better like this because the kinematic is use for many different collision cases, It's just a speculation.
If exemple you connect a kinematic with a set of joints and bodies.
If you move the kinematic body for make move all joints you need to do the same SetSleepState trick on other connected no kinematic bodies.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by JernejL » Thu Apr 11, 2019 11:08 am
Ok, that makes sense - i did not know that and have not yet used kinematic bodies.
We should document this on the wiki
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 9 guests