playMaker

Author Topic: is it possible to get the current rotation of a joint, not the target rotation?  (Read 2481 times)

Fleech

  • Playmaker Newbie
  • *
  • Posts: 44
is there some way to get the current rotation value of a joint, not the target rotation value? i can get something similar using the rotation of the object itself but it would be nice if i could get the actual rotation of value of the joint not the object its attached to.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi, i found this on Unity Answers

and i used the answer to make an action.

You can find it in the attachment below.

Let me know if this is what you are looking for and if it works :)

Fleech

  • Playmaker Newbie
  • *
  • Posts: 44
thanks for responding, i'm getting the error message:

"Assets/PlayMaker Custom Actions/Physics2D/GetJointCurrentRotation.cs(9,36): error CS0117: `HutongGames.PlayMaker.ActionCategory' does not contain a definition for `Physics2D'"

i'm using unity 3D, im not sure that's the cause of this.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi,
What Playmaker version are you using? and what unity version?
You are probably using an older version of Playmaker, then  Physics2D is not yet build-in as standard category.

I have updated the action so it can work on older versions and set it to physics as it is actually not 2D., But...

I would suggest to update Playmaker

if you do be sure to make a backup of your project first
« Last Edit: July 31, 2017, 02:09:39 AM by djaydino »

Fleech

  • Playmaker Newbie
  • *
  • Posts: 44
it does work now, but the floats are different than the target rotation output. its ok, i'll just have to use the object rotation data. 

https://ibb.co/nQaRek
« Last Edit: July 31, 2017, 05:27:22 PM by Fleech »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi,
You can use Get/set properties (drag a component into the state windows and select Set properties)

But i noticed that you need to get x,y,z separately
so if you need a Vector 3 you will also need to use the action "Set Vector3 xyz"


and if you use get/set properties you should use the 'linker wizard' which is easy to use.
Here is a tutorial video for the Linker Wizard.


If it is to much, let me know and i will try to make an action that will get those values :)

Fleech

  • Playmaker Newbie
  • *
  • Posts: 44
basically i just wanted these 2 values to be the same:

http://imgur.com/a/zByL8

i wanted to get a value that was similar to the set target rotation value on the other joint. i planned to get the rotation float of the object and run it through a float operator to get something usable to set the joint with but it would be easier if i could get a similar joint rotation value from another joint at the angle.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi,
Have you tried dropping in the component and use Get Properties?

Here's how you can do this :


Fleech

  • Playmaker Newbie
  • *
  • Posts: 44
i'm struggling to articulate what specifically i'm trying to do. im trying to get the target rotation of the joint by rotating the entire object, so, not getting the target rotation of the joint by setting the target rotation, but getting the target rotation of the joint by rotating the object the joint is attached to. i planned to do this with the rotation data itself but i assumed if the joint rotation angle could be set with the target rotation, you could get the target rotation of the joint based on the angle of the object its attached to. i'm sorry i'm struggling to convey this.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi,
I never really used joints :(
But maybe you could ask this in unity answers how to do this and if they got some answer, link it here so i can maybe help setting this up inside playmaker.