playMaker

Author Topic: Set Joint Connected Body  (Read 7547 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Set Joint Connected Body
« on: March 16, 2012, 06:36:31 PM »
New action to connect a joint to a game object.

EDIT: Changed action to work on any Joint type, not just hinge joints.
« Last Edit: March 20, 2012, 08:25:34 PM by Alex Chouls »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Set Joint Connected Body
« Reply #1 on: March 16, 2012, 06:42:08 PM »
Thank you very much.  What I'm working on at the moment was relying on this, so I'll let you know if anything goes awry shortly.

EDIT: Works perfectly! :)
« Last Edit: March 17, 2012, 07:10:28 PM by artician »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Set Joint Connected Body
« Reply #2 on: March 17, 2012, 07:38:13 PM »
How difficult would it be to make this universally applicable to all joint types?  I failed at making a version of the action for use with Spring Joints.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Set Joint Connected Body
« Reply #3 on: March 20, 2012, 12:36:36 AM »
To be honest I haven't used Unity joints much yet. Hinge joints seem to have special status as a GameObject property, so I started with that...

There are a few different ways I can see to extend this:

1. Instead of using the hingeJoint property, use GetComponent<Joint>() to get the first joint of any type on the object.
2. Or use a popup to select the type of joint to find and connect.
3. Or instead of a GameObject variable type, take an Object variable of type UnityEngine.Joint. You would then need a Get Component action to get the joint you want to connect. IOW, 2 actions instead of one.

1 seems like a good solution if the typical use case is to have a single joint on a GameObject.
2 allows you to have multiple joint types on a GameObject. Is this a common use case?
3 is the most flexible, but requires the most work from the user.

Like I said, I haven't used joints a lot, so I'm not sure which solution is best.

Any thoughts?




Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Set Joint Connected Body
« Reply #4 on: March 20, 2012, 08:27:22 PM »
Okay, I went with option 1 since it's the way the action probably should have worked in the first place!

Also you can use Set Property for option 3.

I edited the download at the top of the thread.

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Set Joint Connected Body
« Reply #5 on: March 20, 2012, 10:57:59 PM »
Alex,

Thank you for this, and sorry I wasn't able to get it working myself when I tried.  I appreciate your effort very much.

I will let you know if I run into any issues with it.