playMaker

Author Topic: cinemachine target group  (Read 701 times)

blackant

  • Sr. Member
  • ****
  • Posts: 426
  • 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: 14832
  • 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

Padenlee

  • Junior Playmaker
  • **
  • Posts: 58
  • You can't hit what you don't shoot for!
    • View Profile
Re: cinemachine target group
« Reply #2 on: January 16, 2020, 09:52:09 AM »
Bump my dude
-Paden Pierry
@padenpierry
Apple inc.'s first TV show, EP 1.
Game Dev since 2007
Coolest client: Bridgestone

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14832
  • Official Playmaker Support
    • View Profile
Re: cinemachine target group
« Reply #3 on: January 17, 2020, 01:18:24 AM »
Hi,

 Ok, made that action so that you can set the target groups. Please download from the Ecosystem Browser.

 you can define the weights and radiuses as well, but leave them to none and they will bet set to default.

Let me know how it goes.

 Bye,

 Jean