Page 1 of 1

How do I make a SliderJoint along Y axis?

Posted: Wed Apr 28, 2021 12:28 pm
by fcy19971208
Hello,
I was trying to make a dampener by constructing a SliderJoint as shown:

Code: Select all

locationInParent3    = Vec3(0.01, -0.1, 0.053);
orientationInParent3 = Vec3(0, 1.57, 0);
locationInChild3     = Vec3(0,0,0);
orientationInChild3  = Vec3(0,0,0);
Lower_left_dampner_joint = SliderJoint('Lower_left_dampner_joint',Dampner_up_l,locationInParent3,...
    orientationInParent3,Dampner_down_l,locationInChild3,orientationInChild3);
lower_left_ty = Lower_left_dampner_joint.upd_coordinates(0);
lower_left_ty.setName('lower_left_ty');
lower_left_ty.getMotionType()
lower_left_ty.setRange([-0.05,0.05]);
lower_left_ty.setDefaultValue(0.02);
lower_left_ty.setName('lower_left_ty');
translation_ly = TransformAxis();
translation_ly.setName('translation_ly');
translation_ly.set_axis(Vec3(0,1,0));
This code won't work since the dampener still vibrates in X axis. My intention was to have the SliderJoint move along Y axis(vertically) instead of X axis(horizontally). What should I do to change the SliderJoint coordinates to Y axis? According to the definition of a SliderJoint "The Slider provides a single coordinate along the common X-axis of the parent and child joint frames." Should I change the parent/child orientation, or should I add TransformAxis?
Please let me know what I could do or provide any insight. Thank you very much!
Best,
Chongyuan

Re: How do I make a SliderJoint along Y axis?

Posted: Fri Apr 30, 2021 10:34 am
by ongcf
I think you could do this by updating the parent/child orientations (through your variables orientationInParent3 and orientationInChild3). Making some small changes, printing the model to file, and checking in the GUI could be helpful in figuring out what exact values are needed.