A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by blackbird_dream » Thu Dec 14, 2017 7:46 am
I've built an articulated mast composed of hingeactuators and slideractuators.
It was quite simple and fast to set up the whole mechanism in Unity3D.
It behaves well, as expected.
But is it normal it freezes up after a while ?
see the captured vid :
https://youtu.be/oUDm_MTowcw
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by blackbird_dream » Thu Dec 14, 2017 9:40 am
I think I found out part of the solution by adding
- Code: Select all
myNewtonBody.SleepState = false;
in the OnApplyForceAndTorque event of the last body of the kinematic chain;
Maybe I must add similar commands in the other dof controls(scripts) of the mechanism ?
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by Sweenie » Thu Dec 14, 2017 10:00 am
By default bodies goes to sleep when they reached an equilibrium state.
That makes the joints "inactive" as well, or rather, contraints do nothing when the connected bodies are asleep. Only a collision with the body or a body linked by a joint will wake it up again.
There is a flag to make a body never go to sleep but I haven't added that to the plugin yet , on the other hand, letting bodies go to sleep should be preferred since it makes the simulation performant.
Instead of keeping the body awake all the time in the OnApplyForceAndTorque event you could just wake the body up when you update the parameters for the actuator. This should wake all connected bodies as well.
This is what we do in the robot demo.
-
Sweenie
-
- Posts: 498
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by blackbird_dream » Thu Dec 14, 2017 10:23 am
ok thks.
In your demo you test whether the GUI.slider has changed or not to set the SleepState to false
Im y example I test if one given button has been hit, for instance :
- Code: Select all
if (Input.GetKey("up"))
Are you saying that I should include the SleepState command inside this test if the answer is true ?
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by Sweenie » Thu Dec 14, 2017 10:52 am
Just set the SleepState to false at the same time you change any param of the actuator joint.
I assume that you do that when you press the up-key.
-
Sweenie
-
- Posts: 498
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by blackbird_dream » Thu Dec 14, 2017 11:07 am
yes, thks. Just to make sure.
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 24 guests