playMaker

Author Topic: How do I set a constraint source??  (Read 1254 times)

RobotGoggles

  • Playmaker Newbie
  • *
  • Posts: 36
How do I set a constraint source??
« on: February 11, 2021, 12:03:43 PM »
I created a health bar for the units in my game and added a rotation constraint so they would always face the same direction as the camera, but it's not working as expected when I instantiate new units into the scene. The constraint source needs to be an instance of an object, so it can't be set on the prefab level and needs to be assigned at runtime.

Typically I would use Get Component and Set Property but I can't find the source property or anything similar. I only seem to be able to modify the weight / offset angle, etc.

Is there some way to change this value through Playmaker?
When life hands you insomnia, make video games.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How do I set a constraint source??
« Reply #1 on: February 11, 2021, 04:07:11 PM »
hi.
Are you using a canvas for the healthbar?

if not you can for example set a canvas to 'world space' and set as a child of your units.

you can also search 'rigidbody constraints' on the Ecosystem

RobotGoggles

  • Playmaker Newbie
  • *
  • Posts: 36
Re: How do I set a constraint source??
« Reply #2 on: February 11, 2021, 04:58:51 PM »
The lifebar is on a worldspace canvas, but it turns away from the camera when the character does.

Rigidbody constraints aren't what I'm looking for - I'm not trying to constrain a rigidbody's motion, I'm trying to set the source on a Rotation Constraint component.
When life hands you insomnia, make video games.