Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by FadeToBlack » Sun Mar 06, 2011 3:27 pm
Julio Jerez wrote:are you using newton 1.53?
i use 2.30
-
FadeToBlack
-
- Posts: 17
- Joined: Thu Sep 09, 2010 7:00 pm
by Julio Jerez » Sun Mar 06, 2011 4:25 pm
In 2.00 bodies are always awake, meaning they always get a force and torque call back.
you is is only when the sum of the net force and net torque add to zero the a body is considered sleeping.
you should not have any problem.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FadeToBlack » Sun Mar 06, 2011 4:54 pm
now i can't say to a body something like NewtonBodyAwake to awake body and bodies which is in contact with it, now i use the hack - i add small force to a body to awake it. problem is appeared when i try to do the same thing with static body(mass=0). in this case, body becomes awaken (NewtonBodyGetSleepState returns false), but body still not interacting with dynamic bodies. i think that body with mass=0 is designed to be static and logic says that this kind of body can not interact with other body if it in sleeping state, but it possible when we call NewtonBodySetMatrix. Static body can loose contacts, can reach contacts when it "teleported" by setting it matrix, but it doesn't work like i say. In other words the problem is what static body can not awake dynamic body.
-
FadeToBlack
-
- Posts: 17
- Joined: Thu Sep 09, 2010 7:00 pm
by Julio Jerez » Sun Mar 06, 2011 5:30 pm
yes body with mass equal zero are always static.
if two bodies with mass = 0 come in contact they do not collide. Is that what you are trying to do?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FadeToBlack » Sun Mar 06, 2011 6:04 pm
Julio Jerez wrote:yes body with mass equal zero are always static.if two bodies with mass = 0 come in contact they do not collide. Is that what you are trying to do?
no. one of my body is static, another is dynamic. when i move static body by NewtonBodySetMatrix it does not come in contact with dynamic body if dymamic body is in sleeping state.
-
FadeToBlack
-
- Posts: 17
- Joined: Thu Sep 09, 2010 7:00 pm
by Julio Jerez » Sun Mar 06, 2011 6:27 pm
if you move a static body, it will penatrate any dynamics body that is resting on it,
howver if you set the velocity of the static body to thr displacement divided the time step, before to call teh newton callback,
then the dynamics body will wakeup and move too.
you do something like this.
- Code: Select all
staticBody->SetVelocity(staticBodyVelocity))
NetwnUpdate (timestep)
staticBodySetMatrix (matrxi.posit + staticBodyVelocity*timestep);
staticBody->SetVelocity(zeroVector)
Make sure the body on top of the static body as set to autosleep off
it should work. few peopel have done that in thier games.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FadeToBlack » Sun Mar 06, 2011 7:04 pm
now i do something like you say, and it will work fine if i switch autosleep to off.
i knew it works, but autosleep is needed, because of perfomance.
i've found some examples in dCustomJoints. is CustomKinematicController what i seek?
-
FadeToBlack
-
- Posts: 17
- Joined: Thu Sep 09, 2010 7:00 pm
by Julio Jerez » Sun Mar 06, 2011 7:54 pm
you need to write code that get the bodies on top of the plaform and switch the autosleep mode when you move the platform, then witch autosleep back on when the platform is not moving
you can find the boded that are touchind the platform very easeely by using the functions
NetwonVodyGetFirstContact(), and NetwonBodyGetNextcontactJoint
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by FadeToBlack » Sun Mar 06, 2011 8:03 pm
when body is in platform, it works fine because body is moving and not going to sleep. but if i want to create some other interactions (for ex. car hits a stack of boxes) i will get some problems (perfomance + manually setting sleep flag to bodies that potentially can be collided by static body)
-
FadeToBlack
-
- Posts: 17
- Joined: Thu Sep 09, 2010 7:00 pm
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 1 guest