Adding constraints seems to put rigid bodies to sleep

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Adding constraints seems to put rigid bodies to sleep

Postby phrydo » Sat Sep 29, 2018 5:55 pm

Hello!

I have a rigid body that starts in the air.
I apply a constant force to it so it moves as expected.
But when I add an up vector constraint to it it no longer moves.
I can make it move by calling NewtonBodySetSleepState(body, 0) on it every frame,
or by changing the force on it.
Calling NewtonBodySetSleepState on it once after the constraint is added does nothing.
Is this the expected behaviour?
Changing the force on the body after it is created or unsleeping it every frame don't seem like good solutions.
I am using the Newton 3.14 release as the CMakeLists in the master branch doesn't work on linux.

this is my code:
Code: Select all
dFloat mat[16] = {0};
mat[0] = mat[5] = mat[10] = mat[15] = 1;
mat[13] = 6;
NewtonCollision *shape = NewtonCreateSphere(world, 1, 0, NULL);
NewtonBody *body = NewtonCreateDynamicBody(world, shape, mat);
NewtonBodySetMassProperties(body, 1, shape);
NewtonBodySetForceAndTorqueCallback(body, force_callback);
dFloat pin[3] = {0, 1, 0};
NewtonConstraintCreateUpVector(world, pin, body);
NewtonDestroyCollision(shape);


Thanks!
phrydo
 
Posts: 5
Joined: Sat Sep 29, 2018 5:23 pm

Re: Adding constraints seems to put rigid bodies to sleep

Postby Julio Jerez » Sat Sep 29, 2018 7:21 pm

you need to use the dCustom joint library
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Adding constraints seems to put rigid bodies to sleep

Postby phrydo » Sat Sep 29, 2018 7:30 pm

Thanks for the quick reply!
I tried that but the issue remained, I am already linking to libNewton.so
phrydo
 
Posts: 5
Joined: Sat Sep 29, 2018 5:23 pm

Re: Adding constraints seems to put rigid bodies to sleep

Postby phrydo » Sat Sep 29, 2018 7:59 pm

*facepalm* i'm having trouble creating a minimal program that exhibits the same behaviour.
please ignore this for now
phrydo
 
Posts: 5
Joined: Sat Sep 29, 2018 5:23 pm

Re: Adding constraints seems to put rigid bodies to sleep

Postby Julio Jerez » Sat Sep 29, 2018 8:42 pm

when do you apply the force, the place to apply force is the force an toque call back, anywhere else an the body will go to rest If the next accelration and velocity is zero.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Adding constraints seems to put rigid bodies to sleep

Postby phrydo » Sat Sep 29, 2018 8:57 pm

yes I apply the force in the force and torque callback
phrydo
 
Posts: 5
Joined: Sat Sep 29, 2018 5:23 pm

Re: Adding constraints seems to put rigid bodies to sleep

Postby Julio Jerez » Sat Sep 29, 2018 9:28 pm

them the body should move is the force is not vertical.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Adding constraints seems to put rigid bodies to sleep

Postby phrydo » Sat Sep 29, 2018 9:34 pm

I figured out that this is caused by passing a zero timestep to the first NewtonUpdate.
Sorry for wasting your time, I should have been more thorough before posting.
phrydo
 
Posts: 5
Joined: Sat Sep 29, 2018 5:23 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests