News:

SMF - Just Installed!

Main Menu

Joint Code

Started by KCP_Robin, September 29, 2015, 02:50:15 AM

Previous topic - Next topic

KCP_Robin

Hello Everyone, I'm trying to connect box index [1] and box index[3] using Joint.. but i can't seem to perfectly match them..
It's purpose is to connect the Arm and the jib conveyor. so when the user press "Up/Down" the Arm will go up and down so as the conveyor.. attached file for editing purposes.. Thank you very much..
I've read the manual for joint but i can't understand how the axis work and positioning .. Any help will be appreciated...  ;D

KCP_Robin


EasyPLC_Master

Due your component uses customized models is diffucult to have an idea about how it looks or what behaviour must to have.
Please can you use standar box models and resend?

KCP_Robin

Here master, please have a look.. I need my Conveyor goes Up and Down together with the Arm to deliver the part... Thank you in advance

EasyPLC_Master

Here is attached the solution.

Points of interest:


  • The Draw() method should be used to drawing routines, for other logic is better Update()
  • Try to locate the main object to move in the center of coordinates, then the logic is easiest
  • Avoid to rotate elements that later must be moved, use the scale properties (see as I have cancelled the rotation by changing X,Z)

The Union Joint are very easy to use, you only must to set the body origin (where to attach) and the body attached. Then move the origin element by code and the attached will be responsible to physics, otherwise the physics doesn't recognize the code forces.

KCP_Robin

Thank you very much.. will have a  thorough look on this ..  ;D

KCP_Robin

Quote from: EasyPLC_Master on October 01, 2015, 11:38:57 AM
Here is attached the solution.

Points of interest:


  • The Draw() method should be used to drawing routines, for other logic is better Update()
  • Try to locate the main object to move in the center of coordinates, then the logic is easiest
  • Avoid to rotate elements that later must be moved, use the scale properties (see as I have cancelled the rotation by changing X,Z)

The Union Joint are very easy to use, you only must to set the body origin (where to attach) and the body attached. Then move the origin element by code and the attached will be responsible to physics, otherwise the physics doesn't recognize the code forces.

Thank you master, I just used the Barrier.cmp on making this idea..  ;)

EasyPLC_Master

The Barrier.cmp uses a little trick, to avoid translate & rotate the barrier arm, the center of the arm model is not located at the center, is located in the joint point with the base where has to rotate, then the logic is easiest.
Also only have a graphical use, the arm will not be integrated in the physics system.

ADVICE:
Remember that you can locate the center of coordinates of your model in the place you want, then you can orbit (Translate & Rotate) the component in a very easy way (using simple functions like Translate or Rotate) and not using Matrix calculations.

ivanrodyk

What is .cmp file? how to us it?

EasyPLC_Master