playMaker

Author Topic: ChatGPT knows how to use Playmaker and is really helpful answering questions  (Read 1918 times)

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
I knew chat gpt knows unity really well but apparently it also knows how to use playmaker....

PROMPT
How would you use the playmaker plugin in unity to drag a card object and place it only in specific areas on the floor?

To use Playmaker to drag a card object and place it only in specific areas on the floor, you can follow these steps:

Create the card object: Create a 3D card object in Unity and add a Playmaker FSM component to it.

Set up the card object: Set up the card object to be draggable by adding a DragRigidbody component or a similar script to it. You can find many tutorials online on how to do this.

Create the specific areas on the floor: Create the specific areas on the floor where the card can be placed. You can use 3D objects, such as cubes or spheres, to represent these areas.

Create FSM states: Create FSM states for the card object. For example, you can create a "Dragging" state, a "Dropped" state, and a "Reset" state.

Create FSM actions: Create FSM actions for each state. For example, for the "Dragging" state, you can create an action that moves the card object along with the mouse cursor, and for the "Dropped" state, you can create an action that checks if the card object is dropped in a valid area.

Set up the FSM transitions: Set up the FSM transitions between the states. For example, when the card object is being dragged, you can transition to the "Dropped" state if it is dropped within a valid area, or transition to the "Reset" state if it is dropped outside of a valid area.

Test and refine: Test the FSM and refine the actions and transitions as needed. You may need to adjust the position and size of the specific areas on the floor to make sure that they are easy to drop the card object into.

By following these steps, you can use Playmaker to create a drag-and-drop system for your card object that restricts it to specific areas on the floor.

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
I tried it out of curiosity. He knows only in general terms, he cannot say anything specific. I mean, it's completely useless.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.
As far as i know.
On discord several peeps even let chat gpt create actions.
So I do not think its useless. its more on how to ask to the chat gpt

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
For example.  I asked it. 

"Make a playmaker action that will tell me which side of a dice is closest to facing the camera"

It made one that took my camera, the dice game object and made an output variable to store the resulting face. Amd I simply copied and pasted it into a new action and it worked.  Blew my mind. 

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
Here is what I got for your request:

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
For whatever reason yours is trying to code in python?

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Prompt: Write me a playmaker action in unity that determines which side of a 6 sided dice is most facing the camera.

Result:
Sure, here's an example Playmaker action that implements the algorithm to determine which side of a 6-sided dice is most facing the camera in Unity:

Create a new Playmaker action by selecting "Tools" -> "Playmaker" -> "New Action" from the Unity menu bar.

Name the action "Get Most Facing Dice Side" and click "Create".

In the "Edit Playmaker Action" window, add the following public variables:

"Dice Object": the GameObject that represents the dice.
"Camera Object": the GameObject that represents the camera.
"Most Facing Face": a GameObject variable that will hold the transform of the face that is most facing the camera.
Add the following code to the "OnEnter" method of the action:

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{

[ActionCategory(ActionCategory.GameObject)]
public class GetMostFacingDiceSide : FsmStateAction
{

public FsmGameObject CameraObject;
public FsmGameObject DiceObject;

public FsmGameObject MostFacingFace;

public override void OnEnter()
{
    // Get the position of the camera relative to the dice
    Vector3 cameraPos = CameraObject.Value.transform.position;
    Vector3 dicePos = DiceObject.Value.transform.position;
    Vector3 cameraToDice = dicePos - cameraPos;

    // Normalize the camera-to-dice vector to get its direction
    Vector3 cameraToDiceDir = cameraToDice.normalized;

    // Get the transform of each face of the dice and calculate the vector from the dice center to each face
    Transform[] faces = DiceObject.Value.transform.GetChild(0).GetComponentsInChildren<Transform>();
    Vector3[] faceDirections = new Vector3[faces.Length - 1];
    for (int i = 1; i < faces.Length; i++)
    {
        Vector3 faceCenter = faces[i].position;
        Vector3 diceToFaceDir = (faceCenter - dicePos).normalized;
        faceDirections[i - 1] = diceToFaceDir;
    }

    // Calculate the dot product between the camera-to-dice direction and each face direction
    float[] dotProducts = new float[faceDirections.Length];
    for (int i = 0; i < faceDirections.Length; i++)
    {
        dotProducts[i] = Vector3.Dot(cameraToDiceDir, faceDirections[i]);
    }

    // Find the face with the highest dot product
    int maxIndex = 0;
    float maxDot = dotProducts[0];
    for (int i = 1; i < dotProducts.Length; i++)
    {
        if (dotProducts[i] > maxDot)
        {
            maxIndex = i;
            maxDot = dotProducts[i];
        }
    }

    // Set the "Most Facing Face" variable to the transform of the face that is most facing the camera
    MostFacingFace.Value = faces[maxIndex + 1].gameObject;

    // Finish the action
    Finish();
}

Save the action and add it to a Playmaker FSM in your Unity scene.

Set the "Dice Object" and "Camera Object" variables to the GameObjects that represent the dice and the camera, respectively.

When the action runs, it will determine which side of the dice is most facing the camera and store the transform of that face in the "Most Facing Face" variable. You can then use this information in other actions or FSMs as needed.

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Custom Action

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.

I noticed there is no
Code: [Select]
public override void Reset()
{

}

which is important for the editor, especially if you copy paste actions.

it should hold all the variables (open some existing action scripts to se a sample)

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
Maybe he is able to create an action for my Slope topic?

adelynschans

  • Playmaker Newbie
  • *
  • Posts: 1
ChatGPT's Playmaker skills are a real game-changer when it comes to simplifying things in the editor. Keeping all the variables intact, especially when copy-pasting actions, can save a ton of time and frustration.

I'm definitely curious to see how this works, and I'll be checking out https://excalibur.guide/ai/ai-resume-writing-prompts/ too. Thanks for sharing this useful insight!
« Last Edit: November 08, 2023, 03:14:00 AM by adelynschans »

DelbertKorte

  • Playmaker Newbie
  • *
  • Posts: 1
Consider adding visual cues or logic to your project using Playmaker, providing feedback or automatically aligning the card object correctly when placed within the specified areas.

DanielJefferson

  • Playmaker Newbie
  • *
  • Posts: 2
When it comes to using Playmaker within Unity for tasks like dragging a card object and placing it in specific floor areas, ChatGPT can provide valuable assistance. You can follow these steps:
Begin by ensuring that Playmaker is properly integrated into your Unity project, which you can acquire from the Unity Asset Store.
Next, create variables within Playmaker to keep track of both the card object and the designated floor areas.
Moreover, if you're interested in exploring how AI can enhance your business operations, you may want to explore the possibilities of the best AI for business solutions. These solutions can provide insights, automate tasks, and facilitate decision-making, ultimately enhancing your business's efficiency and competitiveness.
« Last Edit: February 08, 2024, 07:01:46 AM by DanielJefferson »

Twood

  • Junior Playmaker
  • **
  • Posts: 76
It *can* work but keep in mind AI's hallucinate bad answers at times. It will help to be specific in what you're talking about, and have a lot of awareness yourself about how unity game programming works. It is cool when it does something useful though.

Kihap

  • Playmaker Newbie
  • *
  • Posts: 6
It *can* work but keep in mind AI's hallucinate bad answers at times. It will help to be specific in what you're talking about, and have a lot of awareness yourself about how unity game programming works. It is cool when it does something useful though.
I've been using Playmaker for a while now and I have to say it has changed my workflow. However, I have encountered some limitations when it comes to complex actions. That's why I explore out-of-the-box solutions. I recently came across a fantastic resource - Sloboda Studio where they offer custom development services. Their experience may be the missing piece to overcome Playmaker's limitations and take my projects to the next level. If anyone else has tried out-of-the-box solutions, I'd love to hear about your experiences!

I think that even now, AI has not evolved enough for such complex tasks.
« Last Edit: April 22, 2024, 03:08:40 AM by Kihap »