playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tropical

Pages: [1] 2
1
Share New Actions / Re: Set Mixer Float Value(s)
« on: November 10, 2017, 01:23:59 PM »
Hi,

I've added AudioMixerGetFloatValue action to the Ecosystem and modified my initial post.

Bye

2
Share New Actions / Re: Set Mixer Float Value(s)
« on: November 02, 2017, 01:19:33 AM »
Hi,

thanks for offering your help.
I'll let you know if I get stuck.

Bye

3
Share New Actions / Re: Set Mixer Float Value(s)
« on: November 01, 2017, 09:07:45 AM »
Hi Jean,

I'm on mac.
I will install Unity 5.6 additionally.

Bye

4
Share New Actions / Re: Set Mixer Float Value(s)
« on: October 31, 2017, 03:03:46 AM »
Hi Jean,

thanks a lot for your instructions and sorry for my late reply.
Steps 1 and 2 are completed :-) but I've got a question concerning the unity version:
4: Open that local copy with Unity 5.6
Does this mean Unity 5.6 or newer or does it mean 5.6 only? I'm using Unity 2017 (2017.1 at the moment). Can I open it with 2017?

Bye

5
Share New Actions / Re: Set Mixer Float Value(s)
« on: October 02, 2017, 03:11:40 AM »
Hi Jean,

I would try to put it on the ecosystem myself. Can you give me some instructions? I haven't got a Github account (yet)...

Bye

6
Share New Actions / Re: Set Mixer Float Value(s)
« on: September 24, 2017, 02:50:33 PM »
Is there a way to get AudioMixer float value?

Hello Gua!

Yes, there is (https://docs.unity3d.com/ScriptReference/Audio.AudioMixer.GetFloat.html). However, I don't think there is such a PM-action in the PM package / the ecosystem yet.

The respective action could look like this:

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
// original actions from Tropical: http://hutonggames.com/playmakerforum/index.php?topic=11218.msg52963#msg52963
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/


using UnityEngine;
using UnityEngine.Audio;
using HutongGames.PlayMaker;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Audio)]
[ActionTarget(typeof(AudioMixer), "theMixer")]
[Tooltip("Gets the float value of an exposed parameter for a Unity Audio Mixer. Prior to calling SetFloat and after ClearFloat has been called on this parameter the value returned will be that of the current snapshot or snapshot transition.")]
public class AudioMixerGetFloatValue : FsmStateAction
{
[RequiredField]
[ObjectType(typeof(AudioMixer))]
[Tooltip("The Audio Mixer with the exposed parameter.")]
public FsmObject theMixer;

[RequiredField]
[Tooltip("The name of the exposed parameter.")]
[Title("Name of Parameter")]
public FsmString exposedFloatName;

[RequiredField]
[UIHintAttribute(UIHint.Variable)]
[Tooltip("Store the Float value in a variable")]
public FsmFloat storeFloatValue;

public bool everyFrame;

public override void Reset()
{
theMixer = null;
exposedFloatName = null;
storeFloatValue = null;
everyFrame = false;
}

public override void OnEnter()
{
DoGetMixerFloatValue();

if (!everyFrame)
Finish();
}

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

public void DoGetMixerFloatValue()
{
var _TheMixer = theMixer.Value as AudioMixer;
var _ExposedFloatName = exposedFloatName.Value;

if (_TheMixer!=null && !string.IsNullOrEmpty(_ExposedFloatName))
{
var _storeFloatValue = 0F;
_TheMixer.GetFloat (_ExposedFloatName, out _storeFloatValue);
storeFloatValue.Value = _storeFloatValue;
}
}
}
}

The above code should work  (if you need the action right now...), no errors when testing - though I don't know if it's 'perfect'.

@Jean: The code contains the ECO/PLAYMAKER/ACTION flags (just copied the 3 top lines from the AudioMixerSetFloatValue-action). I haven't put any actions on the ecosystem myself yet. Maybe you could do that, once again :), if you consider the code adequate. Thanks.

Best regards
tropical

7
Share New Actions / Re: Float low pass filter
« on: November 12, 2016, 03:50:03 AM »
Thanks, Jean!  :)

8
Share New Actions / Re: Float low pass filter
« on: November 09, 2016, 02:02:02 PM »
Hi,

_____________________

EDIT:
I think I've found it:

My question was:
Why doesn't this action work whereas the Vector3LowPassFilter-action works perfectly?

My answer:
There's a bug in the code.

Here's a line of the Vector3LowPassFilter-action (working):
Code: [Select]
filteredVector.x = (vector3Variable.Value.x * filteringFactor.Value) + (filteredVector.x * (1.0f - filteringFactor.Value));

And here the respective line of the FloatLowPassFilter-action (not working):
Code: [Select]
filteredFloat = (floatVariable.Value * filteringFactor.Value) + (floatVariable.Value * (1.0f - filteringFactor.Value));

I think 'floatVariable.Value' after the '+'-operator has to be replaced with 'filteredFloat'.
So the code should be:
Code: [Select]
filteredFloat = (floatVariable.Value * filteringFactor.Value) + (filteredFloat * (1.0f - filteringFactor.Value));

Tried and...it works.

@Jean: If I'm not wrong with this diagnosis, the action should be updated.

END EDIT
_________________


ORIGINAL POST:

although this is an old topic I'd like to ask if anyone can explain why this action brings about completely different results compared to the Vector3LowPassFilter-action. The Vector3LowPassFilter-action does its job perfectly while this FloatLowPassFilter-action doesn't seem to have any effect.

Setup 1:
I store the acceleration of my mobile device (using Unity Remote) in a Vector3-Variable with the GetDeviceAcceleration-action, then use the Vector3LowPassFilter (filtering factor 0.1), then store the y-axis as a float using GetVector3XYZ, then update the pitch of a looped AudioSource with the SetAudioPitch-action using the float variable. 'Every Frame' is checked in all actions.
Result:
The natural sudden 'jumping' value changes of the device acceleration are filtered perfectly by the vector3 low pass filter resulting in smooth audio pitch changes. Fine! (without the filter the audio pitch seems to jump between float steps)

But now...
Setup 2:
Everything the same as in Setup 1, except there is no Vector3LowPassFilter before the GetVector3XYZ-action, but a FloatLowPassFilter after it (applied to the float of the Vector3's y-axis), with the same filtering factor. So one should assume there is a similar smoothing effect.
But:
The float filter doesn't seem to have any effect. The changes of the devices accelerometer are not filtered, the audio pitch jumps between different steps - exactly the same as unfiltered.

If you look at the code of the two actions (Vector3LowPassFilter vs. FloatLowPassFilter), nothing seems to explain the different results. Correct me if I'm wrong. EDIT: Well, there is something... ;)

I tried different filtering factors, I also tried changing the FloatLowPassFilter-action using a second Float Variable to store the filtered values and apply this new float to the audio pitch. Doesn't help.

I know this is a very special issue no-one might be interested in but can anyone reproduce and explain this strange difference?

Thanks
Jojo

9
Playmaker Help / Re: Specify Type of FsmArray in Custom Action
« on: February 17, 2016, 04:10:40 PM »
Use the ArrayEditorAttribute with a VariableType. Example:

Code: [Select]
[ArrayEditor(VariableType.GameObject)]
public FsmArray gameObjects;

VariableType values are Float, Int, Bool etc. Code completion should help you find the type you want.

I'll add some documentation to the wiki...

Thanks, Alex!
I'll try that.

10
Playmaker Help / Specify Type of FsmArray in Custom Action [SOLVED]
« on: February 17, 2016, 04:54:17 AM »
Hi,

I try to use an FsmArray variable (Playmaker 1.8+) containing Ints in a custom action. How can I specify the type?
If I use [ArrayEditorAttribute(typeof(int))] or [ArrayEditorAttribute(typeof(FsmInt))] the action does not accept array variables of type 'Int' but only of type 'Object -> Int32' or 'Object -> FsmInt'.
Maybe the solution is too simple and I just don't see it...?
Can anyone help?

Thanks.

11
Playmaker Help / Re: Set Array on another FSM/GameObject
« on: February 07, 2016, 09:30:01 AM »
"FSM Array Set" seemed promising, but that seems to only allow a string to be transferred - nowhere does it ask for the Variable type.

I have noticed that as well. To me the action somehow looks like work in progress. The tooltip text ("Set an item in an Array Variable in another FSM") differs from what is actually done.

12
Share New Actions / Re: Set Mixer Float Value(s)
« on: September 26, 2015, 04:02:27 AM »
Alright,
I've edited my first post.
Thanks Jean!

13
Share New Actions / Re: Set Mixer Float Value(s)
« on: September 24, 2015, 08:33:51 AM »
Thanks, Jean!

I could edit my first post (replace the code/attachments with the changed version from the ecosystem), if you think that's necessary. Or should I leave it as it is?

14
Share New Actions / Re: Set Mixer Float Value(s)
« on: September 24, 2015, 12:06:48 AM »
Hi Jean,

yes, you can put the actions on the Ecosystem. Better you do it. If I touch the cs-files again, the temptation of opening them and changing a word in a tooltip line (or something like that) is too great for me.  :)

Thank you very much.

15
Share New Actions / Set Mixer Float Value(s)
« on: September 23, 2015, 03:18:55 AM »
Hi all,

as I could not find an easy way to access exposed audio mixer parameters with playmaker, I have written an action to set the value of an exposed parameter using the SetFloat function of the unity audio mixer. Then I tried to rewrite it so one can set the values of more than one parameter.

The background: Unfortunately unity's audio mixer snapshot system does not work properly with time scale set to 0 (maybe it will in the future). So you cannot use it in a game pause.
- EDIT (11-10-2017): Ability to transition AudioMixer snapshots by scaled and unscaled time added in Unity 5.3.6 (see Release Notes Unity 5.3.6 and ScriptingAPI-AudioMixer.updateMode) -

Both actions work. Nevertheless... these are my first actions and I have no experience in writing code. So it would be great if someone (maybe Jean) could tell me if there are any "bad", unusual, or unnecessary elements in my actions - especially the second one: I am not sure about the compound array thing and about introducing private variables.

EDIT (09-26-2015): Now both actions are available on the Ecosystem.

See the code on github:

AudioMixerSetFloatValue

AudioMixerSetMultiFloatValues

in the category AudioMixer.

A few things worth mentioning: To use these actions you have to manually expose parameters in the mixer first. Their names in the action editor field have to be written correctly (you can create a string variable if you want). When you set the values of exposed mixer parameters using SetFloat / using these actions, those parameters cannot be controlled by the snapshot system unless you use the ClearFloat function. Watch the unity tutorial (audio mixer exposed parameters).

EDIT (11-10-2017): Another AudioMixer action on the Ecosystem:
AudioMixerGetFloatValue (see code on GitHub: AudioMixerGetFloatValue).

Thank you.
Bye

Pages: [1] 2