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 - speedything

Pages: [1]
1
PlayMaker Help / Re: help with animation curves.
« on: February 14, 2012, 08:00:24 AM »
Personally what I do is have three objects in a heirachy, something like...

Cube -> ANIM -> Model

- The 'cube' object will contain all the FSMs. I can also keep the scale as 1,1,1 regardless of the model's size which can have benefits.
- ANIM will have all the animations attached to it. This should have a position of 0,0,0 (in relation to the parent)
- Model will contain the visual elements. Again, this should have a position of 0,0,0.

This setup has a few advantages to placing everything in a single object, not least that if you want to change the model in the future it can be easily replaced at the lowest level.

For your problem, if you use the above setup you'll be able to move the 'cube' object whilst playing an animation on the ANIM object. This means that when the ANIM object finishes it's jump, the cube object (which it is following) will still have moved and not reset.

2
PlayMaker Help / Re: Get/Set Position
« on: February 08, 2012, 02:43:35 PM »
I've attached a picture of an FSM similar to yours that works as you intend. Its a simple scene with just a wall, a bullet, and a hole (and camera and light). All of the script is shown in the picture.

Hopefully this will solve your problem. Just to clarify, the two pics at the bottom are before I fire missile (red bullet) and after (black hole).

If you're still stuck after this I can maybe try to send the scene, but you'll need to provide a way for me to send the 35MB project to you.

Best of luck

3
PlayMaker Help / Re: Tower Defense game
« on: February 08, 2012, 08:14:37 AM »
Mobile optimisation isn't my strong point, but the two things I can think of are -

1. Use "Get Distance" from each of your towers or units, but use it as infrequently as you can get away with.
2. Stick with the physics, but use the layers and Unity Physics settings to make sure that the units only have connections with detection zones - nothing else. (I was making a PC game with 1000s of people, and doing this not only sped it up significantly, but also stopped it crashing!)

Of course, 100s of towers and units has always got the potential to cause a few speed issues.


4
PlayMaker Help / Re: Get/Set Position
« on: February 08, 2012, 07:18:12 AM »
Ok, try placing the glass object in the scene and out of view (e.g. Vector(0, 1000, 0)).

Then, when the bullet hits, create a new version of that object (as you are doing) instead of using the prefab.


5
PlayMaker Help / Re: Tower Defense game
« on: February 08, 2012, 07:13:22 AM »
There's probably quite a few ways to achieve this. If I was making it I'd probably do something like...

1. Make a detector sphere, and set the collider to "Trigger"
2. Create an FSM and add two states - "Not_Firing" and "Firing"
3. Use the "Trigger Event" action to switch between the two. When a unit enters the detector it will trigger the "Firing" state and when it leaves it will return to "Not_Firing". It will also store the collider object.
4. Somewhere else (maybe the same FSM or another one altogether) you're going to have to track the collider object with Get Position and use this to aim your bullets. The toughest bit will be predicting where it will be when the bullet hits, but I imagine there's some help on how to do this elsewhere on the net.
5. You will also have to be aware of the objects in the trigger radius so that it moves to the next when the first one enters.

Having written all that maybe (to take multiple enemies into account) it would be best to add an FSM to each one and reverse the system. They area the ones looking out for the trigger event and when they hit it they tell another FSM (on a different object) that they,
a. Are in the range of a tower
b. What tower they are in the range of
c. What there priority is (e.g. toughest, fastest, etc.)

This FSM will then get the postion of the highest priority one and then tell the tower to fire at that one until it dies or leaves the radius.


6
PlayMaker Help / Re: Get/Set Position
« on: February 07, 2012, 04:25:09 PM »
I assume you've checked your variable "Colission" and made certain it's not vector(0, 0, 0)?

If you have and it's ok then the problem is definitely when you set the position of the glass. Are you not able to set it directly in the Create Object action?

7
PlayMaker Tips & Tricks / Re: PlayMaker stats
« on: February 03, 2012, 07:58:07 PM »
FSMs : 99
States: 327
Variables: 248
Events: 273

I better make my next FSM a good one (and not the boring 2-state one I had planned!)  :D

8
Share New Actions / Re: Pool Manager 2 spawn
« on: February 02, 2012, 03:37:29 PM »
Thanks for these Pool Manager actions Jean. I'd hacked something together myself for basic spawn/despawn but haven't gone any further and your code is much better and fully functioning anyway.

Really looking forward to seeing the rest of the actions.

9
PlayMaker Help / Re: Set audio clip variable
« on: January 24, 2012, 01:51:46 AM »
Doh - wasn't setting the type properly.

Thanks Jean

10
PlayMaker Help / Set audio clip variable [SOLVED]
« on: January 23, 2012, 12:07:53 PM »
Hi guys,

I'm trying to use the "Set Audio Clip" action with a variable audio object but I can't find the variable. Reproduction steps are...

1. Create an FSM and add an object variable - "audioClip"
2. Select the "Set Audio Clip" action and assign a Game Object with an audio source component. I would expect to be able to assign the variable created in step 1 to the "Audio Clip" field, but it can't see it.

The same thing problem occurs with the "Audio Play" action.

Am I doing something wrong? Or is this a bug with the action?

Thanks,


11
Share New Actions / Get random point in transform
« on: January 06, 2012, 08:20:10 PM »
Following my theme of randomness, here's a new action. It allows you to find a random point within a transform, or at least it will for cubes and rectangles. Not so effective for circular objects...

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions

{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("Gets a Random Position in a Transform")]
public class GetRandomPositionInTransform : FsmStateAction
{
[RequiredField]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
public FsmVector3 vector;
[UIHint(UIHint.Variable)]
public FsmFloat x;
[UIHint(UIHint.Variable)]
public FsmFloat y;
[UIHint(UIHint.Variable)]
public FsmFloat z;
public Space space;
public bool everyFrame;

public override void Reset()
{
gameObject = null;
vector = null;
x = null;
y = null;
z = null;
space = Space.World;
everyFrame = false;
}

public override void OnEnter()
{
DoGetRandomPositionInTransform();

if (!everyFrame)
Finish();
}

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

void DoGetRandomPositionInTransform()
{
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null) return;

Vector3 position;

if (space == Space.World)
{

position = go.transform.position;
}

else
      {
         position = go.transform.localPosition;
}

Vector3 scale;

            if (space == Space.World)

            {
                scale = go.transform.lossyScale;
            }

            else

            {
                scale = go.transform.localScale;
            }

var halfX = scale.x/2f;
var halfY = scale.y/2f;
var halfZ = scale.z/2f;

var randomX = Random.Range(-halfX, halfX);
var randomY = Random.Range(-halfY, halfY);
var randomZ = Random.Range(-halfZ, halfZ);

            x.Value = position.x + randomX;
            y.Value = position.y + randomY;
            z.Value = position.z + randomZ;

Vector3 randomVector3;

randomVector3.x = x.Value;
randomVector3.y = y.Value;
randomVector3.z = z.Value;

vector.Value = randomVector3;

}
}
}

Personally I'm using this to give my AI people a variety of destinations within an area that I can simply bound by creating a rectangle object.

Bye,


12
Share New Actions / Re: Get Random Point On Sphere
« on: January 06, 2012, 08:11:53 PM »
The situation I'm using it for is to generate an asteroid belt around a sun. I get my random point, do a little multiplication on the X and Z, and then instantiate an asteroid at the location.

Most other situations I can think of also involve spawning, but I can imagine it could be used for other things. Maybe generating a random 3D movement direction or similar?

13
Share New Actions / Get Random Point On Sphere
« on: December 16, 2011, 11:39:02 AM »
Hi all,

First post and just want to say that I'm absolutely loving this add-on. I'm Design Director at my company and next year I'm going to try to roll it out to my guys to use for prototyping.

Anyway, here's an action I just had to add for my own project. It will create a random point on a fictional sphere's surface which can be stored either as a Vector3 or as XYZ floats.

Code: [Select]
using UnityEngine;
using System.Collections;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Vector3)]
[Tooltip("Get Random Vector3 from the surface of a radius 1 Sphere")]
public class GetRandomPointOnSphere : FsmStateAction
{

[UIHint(UIHint.Variable)]
public FsmVector3 vector;

[UIHint(UIHint.Variable)]
public FsmFloat x;

[UIHint(UIHint.Variable)]
public FsmFloat y;

[UIHint(UIHint.Variable)]
public FsmFloat z;

public bool everyFrame;

public override void Reset()
{
vector = null;
x = null;
y = null;
z = null;
everyFrame = false;
}

public override void OnEnter()
{
DoGetRandomPointOnSphere();

if (!everyFrame)
Finish();
}

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

void DoGetRandomPointOnSphere()
{
Vector3 position;

position = Random.onUnitSphere;

vector.Value = position;
x.Value = position.x;
y.Value = position.y;
z.Value = position.z;
}


}
}

It's pretty basic code that simply calls Unity's Random.onUnitSphere. Unfortunately the sphere has to be of radius 1 but you can then do stuff with the floats as a second step.

Bye,


Pages: [1]