Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fleech on July 28, 2017, 08:52:48 PM

Title: is it possible to get the current rotation of a joint, not the target rotation?
Post by: Fleech on July 28, 2017, 08:52:48 PM
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.
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: djaydino on July 30, 2017, 05:40:12 AM
Hi, i found this (http://answers.unity3d.com/questions/407040/how-to-get-a-joints-current-positionangle.html) 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 :)
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: Fleech on July 31, 2017, 01:28:28 AM
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.
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: djaydino on July 31, 2017, 02:08:03 AM
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
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: Fleech on July 31, 2017, 05:24:27 PM
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 (https://ibb.co/nQaRek)
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: djaydino on August 01, 2017, 08:11:21 AM
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 :)
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: Fleech on August 02, 2017, 06:54:12 PM
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.
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: djaydino on August 02, 2017, 09:19:27 PM
Hi,
Have you tried dropping in the component and use Get Properties?

Here's how you can do this :

Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: Fleech on August 02, 2017, 09:51:00 PM
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.
Title: Re: is it possible to get the current rotation of a joint, not the target rotation?
Post by: djaydino on August 03, 2017, 07:12:47 AM
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.