playMaker

Author Topic: cinemachine target group  (Read 519 times)

blackant

  • Sr. Member
  • ****
  • Posts: 422
  • http://blackantmaster.com
    • View Profile
    • blackantmaster.com
cinemachine target group
« on: August 02, 2018, 11:46:49 PM »
Hello,

i'm trying to create an action to set Cinemachine TArget group with dynamic transforms, usefull if your targets are not already instanciated when you start the game.

the thing is i don't know how to achieve this code...

Code: [Select]
using Cinemachine;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions.ecosystem.cinemachine
{

[ActionCategory("Cinemachine")]
[Tooltip("Modify Cinemachine Target Group")]
public class CinemachineTargetGroupEditor : FsmStateAction
{
[RequiredField]
[Tooltip("The Cinemachine virtual Camera")]
[CheckForComponent(typeof(CinemachineTargetGroup))]
        public FsmOwnerDefault gameObject;

[RequiredField]
[UIHint(UIHint.Variable)]
[ObjectType(typeof(Transform))]
public FsmGameObject[] storeObjects;
private FsmObject storeTransform;

[ObjectType(typeof(Transform))]
private FsmObject[] touslestransforms;

public FsmBool everyframe;

public override void Reset()
        {
            gameObject = null;
storeObjects = new FsmGameObject[0];
storeTransform = null;
        }

// Code that runs on entering the state.
public override void OnEnter()
{
SetTargetGroup();
            Finish(); 
}

// Code that runs every frame.
public override void OnUpdate()
{
SetTargetGroup();
}

void SetTargetGroup()
{
if (storeObjects == null ) return;

for (var i = 0; i < storeObjects.Length-1; i++)
{
var go = storeObjects[i].Value;
storeTransform.Value = go.transform;

touslestransforms[i]=storeTransform.Value;
}
}
}

}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14316
  • Official Playmaker Support
    • View Profile
Re: cinemachine target group
« Reply #1 on: August 20, 2018, 12:07:08 AM »
Hi,

 Sorry for the delay in reply, I was on vacation.

 Did you get some progress on this?

 Bye,

 Jean