Hinge springs

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Hinge springs

Postby Leadwerks » Tue May 02, 2017 7:10 pm

I have not gotten a chance to try the hinge springs yet, but I can't tell you how happy I am to have springs built into the hinge and slider joints. Thank you! :lol: :lol: :lol:
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Hinge springs

Postby AntonSynytsia » Wed May 03, 2017 12:39 am

Angular springs follow the same concept as linear springs. Instead of keeping track of position and velocity, you keep track of angle and omega.

This is how applying the angular row along the rotational axis of the hinge should look like, if m_front is the up direction of the hinge:
Code: Select all
dFloat lastAngle = m_curJointAngle.GetAngle();

dFloat sinAngle;
dFloat cosAngle;
CalculateAngle(matrix1.m_up, matrix0.m_up, matrix1.m_front, sinAngle, cosAngle);
m_curJointAngle.Update(cosAngle, sinAngle);
   
dFloat curAngle = m_curJointAngle.GetAngle();
dFloat curOmega = (curAngle - lastAngle) / timestep;

dFloat desiredAccel = NewtonCalculateSpringDamperAcceleration(timestep, m_accel, curAngle, m_damp, curOmega);

NewtonUserJointAddAngularRow(joint, curAngle, &matrix1.m_front[0]);
NewtonUserJointSetRowAcceleration(m_joint, desiredAccel);
NewtonUserJointSetRowStiffness(m_joint, m_stiffness * 0.4f);


I have got this working in my wrapper.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron