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.


Topics - Neural Echo

Pages: [1]
1
Share New Actions / Find Closest - Now with an Ignore Owner option
« on: April 06, 2011, 05:21:23 PM »
Here's a slightly modified version of the built-in Find Closest action that optionally allows the user to ignore the object that owns the FSM that contains this action.

To update the built-in action with this version, replace the code inside the Assets/PlayMaker/Actions/FindClosest.cs script with the code below.


Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GameObject)]
[Tooltip("Finds the closest object to the specified Game Object.\nOptionally filter by Tag and Visibility.")]
public class FindClosest : FsmStateAction
{
[RequiredField]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Tag)]
public FsmString withTag;
[Tooltip("If checked, ignores the object that owns this FSM.")]
public bool ignoreOwner;
public FsmBool mustBeVisible;
[UIHint(UIHint.Variable)]
public FsmGameObject storeObject;
[UIHint(UIHint.Variable)]
public FsmFloat storeDistance;
public bool everyFrame;


public override void Reset()
{
gameObject = null;
withTag = "Untagged";
mustBeVisible = false;
storeObject = null;
}

public override void OnEnter()
{
DoFindClosest();

if (!everyFrame)
Finish();
}

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

void DoFindClosest()
{
GameObject go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;

GameObject[] objects = GameObject.FindGameObjectsWithTag(withTag.Value);
GameObject closestObj = null;
var closestDist = Mathf.Infinity;

foreach (var obj in objects)
{
if (ignoreOwner && obj == Owner)
continue;

if (mustBeVisible.Value && !ActionHelpers.IsVisible(obj))
continue;

var dist = (go.transform.position - obj.transform.position).sqrMagnitude;
if (dist < closestDist)
{
closestDist = dist;
closestObj = obj;
}
}

storeObject.Value = closestObj;
storeDistance.Value = closestDist;
}
}
}

2
Forum Suggestions / Forum link on home page
« on: April 01, 2011, 05:56:41 AM »
It would be good if you had a link to the playMaker forum on the playMaker/HutongGames home page (or all pages). I have to Google the URL almost every time I want to visit.  :-[

3
Forum Suggestions / Faster Forum Server(s)/Connection
« on: March 28, 2011, 07:50:07 AM »
Having a dedicated playMaker forum is great. However, the user experience is diminished because pages take so long to load. Is there any chance you can beef up the hardware or connection speed of the server that is hosting it? Thanks.

4
Feature Requests / Action filter field [implemented]
« on: March 25, 2011, 09:58:24 AM »
As the list of available actions is continuing to grow, could you please add a text field at the top of the 'Actions' panel that allows you to filter the actions being displayed.

For example, if you type 'anim' into the field, all actions with the string 'anim' in their title (and possibly in/under their internal variables and/or descriptions) would be displayed, potentially under their respective category headings (with unmatched category headings and actions filtered out).

When the user deletes the text in the filter field the Actions panel should return to displaying entire list of headings for all Action categories. An 'x' delete button should also be included to the right of the filter text field to allow it to be cleared by clicking on the 'x'.

Pages: [1]