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

Pages: [1] 2
1
Playmaker Help / Look At Lagging
« on: October 31, 2017, 08:56:54 PM »
I'm not sure what's going on but I'm trying to set up a health bar gui canvas to follow the player follow. When I use "Look At", the game lags like crazy. I'm using Core GameKit to spawn in the AI that's using the health bar gui.

2
Playmaker Help / Re: Camera rotation and Player movement
« on: June 03, 2017, 06:55:38 PM »
I believe it will be better to use this thread instead of making a new one because it's kind of what I'm looking for.

I'm using the Free Look Camera prefab from the Unity Standard Assets for diving a vehicle. I would like to know how I can make the camera rotate behind the vehicle when the player moves the vehicle forward? The same goes for backwards.

Example video.
https://www.youtube.com/watch?v=DYz4-0pCO3s

3
Playmaker Help / Re: GUI that follows a GameObject
« on: May 23, 2017, 06:28:48 AM »
Thank you for the info. I didn't think about of using the "GameObjectIsVisible" action. I got it working.

4
Playmaker Help / Re: GUI that follows a GameObject
« on: May 21, 2017, 06:29:37 PM »
I know this is a old topic but I feel there is no need to start a new when my question deals with this topic.

I noticed that when you turn 180 degree from the gameobject the text is still visible. Is there a way to fix this?

Looking at object
https://postimg.org/image/c5bw1himn/

Looking away from object
https://postimg.org/image/5dlgymtn3/


5
Share New Actions / Re: NGUI HUD Text Actions
« on: February 07, 2017, 12:23:18 AM »
Okay, I have figured most of what I asked out.

Not sure how to get multiple progress bars for multiple characters.

How can I turn a digit number (like 68) into a decimal (0.68)? I'm trying to change a float from like 68 to 0.68.

6
Share New Actions / Re: NGUI HUD Text Actions
« on: February 06, 2017, 11:31:22 PM »
Also how do you update the progress bar of the health?

7
Share New Actions / Re: NGUI HUD Text Actions
« on: February 06, 2017, 11:28:46 PM »
I see. So what I just did was add the "Control - Simple Progress Bar" to my scene. It automatically added the UI Root. Then in playmaker I added the FSM like in my picture and assigned the components to the progress bar. Now in game the progress bar shows up and follows the AI around.

But I noticed that when you turn the player around the progress bar stays at the edge of the screen until you look back at the AI and then it follows the AI again.

Another question, that just came up. In the UI Follow Target, how can you define multiple targets?

8
Share New Actions / Re: NGUI HUD Text Actions
« on: February 06, 2017, 11:12:40 PM »

9
Share New Actions / Re: NGUI HUD Text Actions
« on: February 06, 2017, 11:01:38 PM »
Code: [Select]
//--------------------------------------------
//            NGUI: HUD Text
// Copyright © 2012 Tasharen Entertainment
//--------------------------------------------

using UnityEngine;

/// <summary>
/// Attaching this script to an object will make it visibly follow another object, even if the two are using different cameras to draw them.
/// </summary>

public class UIFollowTarget : MonoBehaviour
{
public delegate void OnVisibilityChange (bool isVisible);

/// <summary>
/// Callback triggered every time the object becomes visible or invisible.
/// </summary>

public OnVisibilityChange onChange;

/// <summary>
/// 3D target that this object will be positioned above.
/// </summary>

public Transform target;

/// <summary>
/// Game camera to use.
/// </summary>

public Camera gameCamera;

/// <summary>
/// UI camera to use.
/// </summary>

public Camera uiCamera;

/// <summary>
/// Whether the children will be disabled when this object is no longer visible.
/// </summary>

public bool disableIfInvisible = true;

/// <summary>
/// Destroy the game object when target disappears.
/// </summary>

public bool destroyWithTarget = true;

Transform mTrans;
int mIsVisible = -1;

/// <summary>
/// Whether the target is currently visible or not.
/// </summary>

public bool isVisible { get { return mIsVisible == 1; } }

/// <summary>
/// Cache the transform;
/// </summary>

void Awake () { mTrans = transform; }

/// <summary>
/// Find both the UI camera and the game camera so they can be used for the position calculations
/// </summary>

void Start()
{
if (target)
{
if (gameCamera == null) gameCamera = NGUITools.FindCameraForLayer(target.gameObject.layer);
if (uiCamera == null) uiCamera = NGUITools.FindCameraForLayer(gameObject.layer);
Update();
}
else
{
if (destroyWithTarget) Destroy(gameObject);
else enabled = false;
}
}

/// <summary>
/// Update the position of the HUD object every frame such that is position correctly over top of its real world object.
/// </summary>

void Update ()
{
if (target && uiCamera != null)
{
Vector3 pos = gameCamera.WorldToViewportPoint(target.position);

            // Determine the visibility and the target alpha
            int isVisible = (gameCamera.orthographic || pos.z > 0f) && (pos.x > 0f && pos.x < 1f && pos.y > 0f && pos.y < 1f) ? 1 : 0;
bool vis = (isVisible == 1);

// If visible, update the position
if (vis)
{
pos = uiCamera.ViewportToWorldPoint(pos);
pos = mTrans.parent.InverseTransformPoint(pos);
//pos.x = Mathf.RoundToInt(pos.x);
//pos.y = Mathf.RoundToInt(pos.y);
pos.z = 0f;
mTrans.localPosition = pos;
            }

// Update the visibility flag
if (mIsVisible != isVisible)
{
mIsVisible = isVisible;

if (disableIfInvisible)
{
for (int i = 0, imax = mTrans.childCount; i < imax; ++i)
NGUITools.SetActive(mTrans.GetChild(i).gameObject, vis);
}

// Inform the listener
if (onChange != null) onChange(vis);
}
}
else Destroy(gameObject);
}
}

10
Share New Actions / Re: NGUI HUD Text Actions
« on: February 06, 2017, 10:58:35 PM »
Code: [Select]
// If visible, update the position
if (vis)
{
pos = uiCamera.ViewportToWorldPoint(pos);
pos = mTrans.parent.InverseTransformPoint(pos);
//pos.x = Mathf.RoundToInt(pos.x);
//pos.y = Mathf.RoundToInt(pos.y);
pos.z = 0f;
mTrans.localPosition = pos;
            }

11
Share New Actions / Re: NGUI HUD Text Actions
« on: February 06, 2017, 06:24:28 PM »
I'm trying to get this to work but I'm having a issue where the character is getting moved to the position of the UI Root (2D) and is invisible.

I'm getting this error.
Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
UIFollowTarget.Update () (at Assets/HUD Text/Scripts/UIFollowTarget.cs:104)

12
Playmaker Help / Re: Run State If only
« on: January 02, 2017, 04:18:42 PM »
This is how I have the camera change when the player mounts a rideable gameobject such as Blitz.

https://postimg.org/image/4b33wh6vj/

https://postimg.org/image/gqztq807j/

https://postimg.org/image/fpzl13j7z/

https://postimg.org/image/dmp5tfjf3/

I have two rideable objects in the scene; Mount 1 and Mount 2. When the player mounts and unmounts Mount 1 the camera changing works fine. But when the player mounts Mount 2 the camera changes to Mount 1. Each mount has its own FSM.

FYI: I'm using Third Person Controller from Opsive.

13
Playmaker Help / Run State If only
« on: January 02, 2017, 11:17:50 AM »
I'm not sure how to get a state working where the state is only ran if the "correct" gameobject is used.

Example: Player stands by "Mount 1" and presses the use keybind. The state checks to see if "Mount 1" is by the player if it's true then the state runs. If the gameobject is something else then the state doesn't run.

I hope this makes sense. If not I'll come up with a better example.

14
Playmaker Help / Re: Random Item Generator
« on: November 20, 2016, 08:21:04 PM »
How would you tell it to spawn where that destroyed GameObject was?

EDIT:
I figured it out. I just needed to drag and drop the parent prefab into the spawn point. It's working now.

Thank you for the help.

15
Playmaker Help / Random Item Generator[SOLVED]
« on: November 20, 2016, 05:15:09 AM »
I have searched the forums for this but I haven't found any success yet.

Anyway, I'm looking create a item generator where a player can destroy a GameObject and a random item will be spawned using playmaker. Is there any tutorials or guides that anyone knows?

Thanks

Pages: [1] 2