Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: brendang on May 20, 2012, 02:54:26 PM

Title: 'Offset' in 2d Wave Mesh (Mega-Fiers)[SOLVED]
Post by: brendang on May 20, 2012, 02:54:26 PM
I'm sure this could work for more than this one attribute.  But I'd like to be able to slowly increment the (texture) offset in this MegaShape within Mega-Fiers

Is there a generic way to access these type of attributes?

thanks,
B
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)
Post by: jeanfabre on May 24, 2012, 03:29:20 PM
hi,

 Here we go :)

 I haven't put all the common parameters here, I think I would prefer cutting it down into sections actually, to avoid a messy do it all action that would most of the time be too much for the need.

Warning, some modifier will not react to the offset and some values of the position and rotation, simply work it out in the component itself, if that works, then this action will work too.

Code: [Select]

// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Mega-Fiers")]
[Tooltip("Set the transform common parameters of a Mega-Fiers modifier.")]
public class MegafiersSetModifierTransform : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(MegaModifier))]
[Tooltip("The GameObject to check.")]
public FsmOwnerDefault gameObject;


[Tooltip("The offset")]
public FsmVector3 offset;

[Tooltip("The gizmo Position")]
public FsmVector3 gizmoPos;

[Tooltip("The gizmo Rotation")]
public FsmVector3 gizmoRot;

[Tooltip("The gizmo Scale")]
public FsmVector3 gizmoScale;

[Tooltip("Repeat every frame")]
public bool everyFrame;

public override void Reset()
{
gameObject = null;
offset = null;
gizmoPos = null;
gizmoRot = null;
gizmoScale = new FsmVector3();
gizmoScale.Value = new Vector3(1,1,1);

everyFrame = false;
}

private MegaModifier megaModifier;

public override void OnEnter()
{

var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}
megaModifier = go.GetComponent<MegaModifier>();

if (megaModifier == null)
{
LogError("Missing MegaModifier!");
return;
}


DoSetOffset();

if (!everyFrame)
{
Finish();
}
}

public override void OnUpdate()
{
DoSetOffset();
}

void DoSetOffset()
{
if ( megaModifier !=null)
{
if (offset.Value != megaModifier.Offset)
{
megaModifier.Offset = offset.Value;
}

if (gizmoPos.Value != megaModifier.gizmoPos)
{
megaModifier.gizmoPos = gizmoPos.Value;
}
if (gizmoRot.Value != megaModifier.gizmoRot)
{
megaModifier.gizmoRot = gizmoRot.Value;
}
if (gizmoScale.Value != megaModifier.gizmoScale)
{
megaModifier.gizmoScale = gizmoScale.Value;
}
}
}
}
}

If you need other functions, do not hesitate :) you can always use this action as a base if you have some scripting knowledge, else I can help out.


 Bye,

 Jean
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)
Post by: jeanfabre on May 24, 2012, 03:33:20 PM
Hi,

 forgot to explain how to do that generically:

Create a Fsm Object variable, set its class to "MegaModifier", point it to the gameObject you want to control, and then use the action "set property", use that Fsm Object you have created, and you will access all the properties ( including the one I expose in this action). so you can pretty much control any component ( not just Mega Fiers ones)  anything this way.

Bye,

 Jean
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)
Post by: t4d on October 23, 2013, 05:46:29 AM
sorry where do i or how do i "set it's class" ?  to MegaModifier is that the name i should call the Variable ?

can you post a example playmaker tree or show how you would control a megafier values please sorry newbie but Loving playmaker great stuff  ;)

sorry learning alot, this gave me what i needed  ;)
http://www.youtube.com/watch?v=QVG-336_PsM (http://www.youtube.com/watch?v=QVG-336_PsM)

no sorrry any links or ideas how to connect to a C# script ?
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)
Post by: jeanfabre on October 24, 2013, 02:58:19 AM
Hi,

 Can you give me a concrete example. What modifier and what value do you want to actually control?

bye,

 Jean
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)
Post by: t4d on October 29, 2013, 12:45:25 AM
no need now but for everyone else who may read this ,. I was all Joy with i found you can just drag scripts into the Playmaker window and choose the value you need to control EASY with object with multi Magafier deformers just make sure you put in the ID value in as well and all is cool

Playmaker rocks Jean !!  ;D
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)
Post by: jeanfabre on October 29, 2013, 02:25:41 AM
Hi,

 yep, PlayMaker rocks big time!

bye,

 Jean
Title: Re: 'Offset' in 2d Wave Mesh (Mega-Fiers)[SOLVED]
Post by: Headtrip on October 29, 2013, 05:33:46 PM
Thanks!! I will try that!
Playmaker beyond rocks for me, its an absolute core component!