playMaker

Author Topic: FSMVector4  (Read 4349 times)

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
FSMVector4
« on: October 07, 2013, 09:01:05 AM »
I thought I would create a new subject as it might need to be created.

This is in response to the topic:
Custom Scripts: drop down list of variables

http://hutonggames.com/playmakerforum/index.php?topic=5133.0
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSMVector4
« Reply #1 on: October 07, 2013, 09:09:01 AM »
Hi,

 I guess this is sorted right?

bye,

 Jean

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: FSMVector4
« Reply #2 on: October 07, 2013, 10:34:54 PM »
Unfortunately not.

I have attached a screenshot of the problem.
Basically I am creating custom scripts for Rain AI. I have just one last piece to fix and that is the retrieval and changing of Rain Vector4 into playmaker.

I can store the results I need in FSMQuaternion (Get method - as is shown in the image with 4.0 values)

But when I try to set the value it doesnt line up. value of 10.0 in the set method changes the value in the Rain Vector4.

I can also only edit 3/4 FSMQuaternion values so thats also a limit on what I can do.

That is why I am thinking I might need a FSMVector4 unless there is a way to use FSMQuaternion for Vector4
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSMVector4
« Reply #3 on: October 08, 2013, 03:05:04 AM »
Hi,

 I see, indeed it's not going to be possible to store a vector4 into a FSMQuaternion purely because the playmaker widget ui for quat doesn't expose the W, but only the angles. So your vector4 values will be all wrongs.

 try instead to use colors, colors are vector4.

bye,

 Jean

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: FSMVector4
« Reply #4 on: October 08, 2013, 07:49:53 AM »
How will the user be able to edit the FSMColor variables.

I am trying to create getters and setters for the Vec4.

If I store the vec4 inside of a color variable I am not sure how they will continue to edit the variable in playmaker.

At the moment the getter method works but not the setter.

I have gone back to the Rain guys and asked them the reasons for using a vector4 over quaternion. It might come down to what they have available.

Also in debug mode you can see all 4 value of the FSMQuaternion just not in the UI part.

If I did store the Vec4 in a color variable. How will the user be able to edit the value in playmaker and create FSM like they normally would?

Thanks for all your help Jean.

Greatly appreciated.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSMVector4
« Reply #5 on: October 08, 2013, 08:07:04 AM »
Hi,

 Sorry, I though you only had to store info in a vecto4, not have the user edit it.

 then you'll have to create your own interface. using Unity Editor and PlayMaker custom actions editor combined.

Do you think you can manage or do you need an example on how to create playmaker actions custom editors?

Bye,

 Jean

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: FSMVector4
« Reply #6 on: October 08, 2013, 09:05:04 AM »
Hi Jean,

Is there an example of how to do this?
Would I be able to expose the FSMQuaternion w or would I need to create a new FSMVariable?

Rain AI has the following variables you can use:
float
int
string
vector2
vector3
vector4
GameObject

Vector4 is the only missing part. There is still a lot behind the Rain AI but I am thinking that we only need to edit the variables in playmaker and let Rain editor handle the rest.

I am currently in the process of having a cube act as an animal.

I can change a variable in playmaker which acts as it hunger levels and use the Rain AI to make the cube move around to get the food.

When the demo is finished I will make the scripts available to you and probably create a youtube video tutorial for the other playmaker users.

All the best.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSMVector4
« Reply #7 on: October 08, 2013, 02:49:02 PM »
Hi,

 Ok, Please find an action and its custom editor to demonstrate one way to go about this.

 Basically, I mix quaternion and vector4, so that within the GUI, I use Unity default Vector4 editing fields, yet saving into a quaternion within a FsmQuaternion PlayMaker variable.

 Basically, don't look at the inspector for the FsmQuaternion values, instead look in the variable tab, it will show x,y,z and w, instead of the euler angles. That's the drawback. Using FsmColor will also be problematic... cause you will see a color picker... :)

Ideally, it woul dbe nice to have a proper build in FsmVector4.. Maybe one day:) Alex is very keen on AI stuff, so maybe if you push it will happen :)

 If you have questions let me know.
« Last Edit: October 09, 2013, 05:56:48 AM by jeanfabre »

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: FSMVector4
« Reply #8 on: October 09, 2013, 03:48:46 AM »
Thanks Jean,

Would Alex be interested in being involved with the AI process?

I got this error with the script:

Assets/PlayMaker Custom Actions/API/FsmVector4Action.cs(10,41): error CS0246: The type or namespace name `QuaternionBaseAction' could not be found. Are you missing a using directive or an assembly reference?


I tried adding in:

using HutongGames.PlayMaker;
using UnityEngine;
using System.Collections;

I am guessing your extending the base class are you?
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSMVector4
« Reply #9 on: October 09, 2013, 05:57:20 AM »
Hi,

 oupss.. redownload please, I fixed it.

bye,

 Jean

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: FSMVector4
« Reply #10 on: October 10, 2013, 04:33:47 AM »
Thanks Jean,

I have sent Alex an email.

I will keep you guys posted on how I go with it.
I am just working on a demo with Vuforia, Rain AI and Playmaker.

Thanks again for all your help.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith