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

Pages: [1] 2
1
Please feel free to try this code if you need to get data/values from webPlayer to PlayMaker.

Use: Pull Data from a database and use those to invoke PlayMaker actions.

WebPlayer
Code: [Select]
<script type="text/javascript" src="UnityObject.js"></script>
<script type="text/javascript">
<!--
function GetUnity() {
if (typeof unityObject != "undefined") {
return unityObject.getObjectById("unityPlayer");
}
return null;
}
if (typeof unityObject != "undefined") {
unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", 400, 400);

}
-->
</script>
<script type="text/javascript">
<!--

function getAnimClip(Void)
{   
// [unityGameObject],[FuntionName],[Vals(Array) to be passed to Unity]
GetUnity().SendMessage( "wwwCom", "myAnimationCall", "Human^Male^M16^crouchM16" );
}

-->
</script>
[/b]
wwwCall.cs
Code: [Select]
using UnityEngine;
using HutongGames.PlayMaker;
using System.Collections;

public class wwwCall : MonoBehaviour
{
//set a Spot in the Editor for PlayMaker Object
public PlayMakerFSM wwwPlayer;

// Use this for initialization
void Start ()
{
//we know the web player has now loaded: lets get that data string!!
Application.ExternalCall("getAnimClip", 0);
}
void myAnimationCall(string indata)
{
//Lets Try to Get and Parse that browser data!!
try
{
//Heres the data from the web page, lets Split it on my [^] Char.
string[] words = indata.Split('^');
//Now That I have the Data Split into the Values I need, let's go ahead and send to PlayMaker!!
            wwwPlayer.FsmVariables.GetFsmString("strCat").Value = words[0];
            wwwPlayer.FsmVariables.GetFsmString("strGender").Value = words[1];
            wwwPlayer.FsmVariables.GetFsmString("strAction").Value = words[2];
            wwwPlayer.FsmVariables.GetFsmString("strFileName").Value = words[3];
//Debug.Log (indata);
}
catch
{
//Debug.Log("NO DATA!!!!!!!!!");
}
}
}

2
well. it seems it should work..its not...

I'll go back again..maby because I a trying to set global FSMvars by script??
Maby I am putting blocks of code in the wrong place.

It seems like that is exactly what you described..this was my last attempt before posting "help"
I was coding for ten 10 hours . .net/sql/asp/c#/unityscript..going through every search link I could find..

This is a pretty importany peice to my business model.

so , as you can see..I made a valid attempt..and should be pretty close, if not there.

anyway..look at code, see if there is any Glaring mistakes..

Thanks for your help!!


p-

3
here what I tried..

1).
Code: [Select]
<%
            ConnectString = "Driver={SQL Server}; Server="
            Set Conn = Server.CreateObject("ADODB.Connection")
            'open the databse connection
            Conn.Open ConnectString

            'strProd_Category = "Human"
            'strProd_Gender = "Male"
            'strProd_subCategory = "M16"
            'strProd_Filename = "crouchM16.anim"

            strProd_Category = Request("strProd_Category")
            strProd_Gender = Request("strProd_Gender")
            strProd_subCategory = Request("strProd_subCategory")
            strProd_Filename = Request("strProd_Filename")

            SQLCmdAnimFile = " SELECT TOP(1)* FROM ProductFile WHERE Prod_Category LIKE '" & strProd_Category & "' AND " &_
            "" & " Prod_Gender LIKE '" & strProd_Gender & "' AND  Prod_subCategory LIKE '" & strProd_subCategory & "' AND Prod_Filename LIKE '" &  strProd_Filename & "'"

            SET DataRS = Conn.Execute(SQLCmdAnimFile)
            Response.Write "<br>SQLCmdAnimFile: " & SQLCmdAnimFile

   IF NOT DataRS.EOF THEN
            DO WHILE NOT DataRS.EOF

            Prod_Category   = DataRS("Prod_Category")
            Prod_Gender = DataRS("Prod_Gender")
            Prod_subCategory = DataRS("Prod_subCategory")
            Prod_Filename  = DataRS("Prod_Filename")
            strProd_Name = Replace(Prod_Filename,".anim","",1)


               strFile = Prod_Category & "^" & strProd_Gender & "^" & Prod_subCategory & "^" &  strProd_Name

   DataRS.MOVENEXT
   LOOP
   ELSE
                strFile = "crouchM16_runBackwards"
   End If

                Response.Write "<br> Data I am Pushing to Unity: <br>" & strFile

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unimations.com WebPlayer</title>
<script type="text/javascript" src="Scripts/UnityObject.js"></script>
<script type="text/javascript">
<!--
   function GetUnity() {
       if (typeof unityObject != "undefined") {
           return unityObject.getObjectById("unityPlayer");
       }
       return null;
   }
   if (typeof unityObject != "undefined") {
       unityObject.embedUnity("unityPlayer", "SoldierPlayer_M16/WebPlayer/WebPlayer.unity3d", 400, 400);
       unity.SendMessage("wwwCall", "myAnimationCall", "<%=strFile%>");
   }
-->
</script>
#2). Inside Uinity wwwCall()

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

public class wwwCall : MonoBehaviour {

public PlayMakerFSM wwwCbj;

public FsmString Cat;
public FsmString Gender;
public FsmString Action;
public FsmString FileName;

private string strCat;
private string strGender;
private string strAction;
private string strFileName;

// Use this for initialization
void Start ()

{

}

// Update is called once per frame
void Update ()
{
Cat = strCat;
Gender = strGender;
Action = strAction;
FileName = strFileName;

Cat = wwwCbj.FsmVariables.GetFsmString("strCat");
Gender = wwwCbj.FsmVariables.GetFsmString("strGender");
Action = wwwCbj.FsmVariables.GetFsmString("strAction");
FileName = wwwCbj.FsmVariables.GetFsmString("strFileName");
}

void myAnimationCall(string indata)
{
string[] words = indata.Split('^');

strCat = words[0];
strGender = words[1];
strAction = words[2];
strFileName = words[3];
Debug.Log (indata);
}


}

4
I am trying to build a web player that play animations based on Character Gender and Action Type: animation..
That would actually get me there.

scenario:

user wants to see: male pistol fire

now I want to get that in play maker and load unoad male/female.
Then depending on action type :Hand/Pistol/Sword/M16, etc..
I can hide or unhide the weapon pack prefab item.

the anim name does hold action type, so I could , 'InString that..'

but how to I place the player on a differen/new window (than the list).

I would really like an iFrame / or ajax window, so when you click on the list, the right character and animation will play..

simple...

5
I am building this Unity3D Web Site/App.

re.--------------------
UNImations is dedicated to providing free and inexpensive characters and motion
captured based animations.

 All assets are run through the Unity3D game engine and the web player will show you exactly what your getting. I have decided to use two common rigs(bones), one female and one male. This allows me to re-target my entire library of mocaps, much more easily!! Take a look at some of my video captures and sample web players
----------------------
HD Video: explains more: http://www.youtube.com/watch?v=ulLBsjBYK4s  
UNImations.com (free prefabs and animations)
shop.UNImations.com (paid prefabs and animations)

I am trying to get a string value into FSMvariables.
Please take a look at this, it should explain everything..

Animation Search page: http://unimations.com/anims.aspx

I have tried www. wwwFor, wwwAction (but do i create a custum string parse action?
I am Sooo Close..

I know playmaker will get the animation string, and play it. that works but, I need 3 more string variables.
I know  I can get Unity/Playmaker to play animation by name gender and action type.

Thanks

Patrick

6
ok..I think I got it....(at least close enough for a designer :-) )

player hits the OnExit State : (he is in the air)
  Get [self] Position and Rotation of "_startRotObject" [empty sphere ]

  Set [self]  Postion of "_startRotObject"  to Player current "OnExit" (inAir) Position
(move the sphere to my position and rotation)

  Monitor the Rotation [Delta] of My current Pos/Rot now called : [target] from "_startRotObject" Pos/Rot

  Add Total [Delta] Values at FixedUpdate 30 fps / divide total vales by [69-89]??

right now, its close enough!!, I know when he does a 180/360/540, etc.front flip, back flip.


Thanks!!

7
I can not figure this out..
he passes 0 to 180 and then goes back to 0 again.
so I place a float check at 90 and 180
doesn't work 79/179..nope..um 70 and 160..at least this hits..but to many.

ARGHHH!!!!

I feel so stupid that I can not figure out in playmaker to get this work.

I have tried every logic and conversion operator I could think of.
There is  a magic action/state/equation that I can not grasp...

I can see the numbers..they are right..

90 is 45 degrees and 180 is 90 degrees
when he reaches 180 degrees, the delta values then start moving back to zero.
so when he has done a 360, he has gone from 0->180 and back from 180 -> 0
I just can not figure out the logic behind my wanted result.

please give me a clue.

p

8
ok..I thought about this some more and..(not implemented yet)

When the game object w/ rigidbody enters the OnExit (in air)
I set an empty game objects vector3 w/ my players vector 3
that now becomes the object [start rotation] while continously
monitoring the delta of Target [Player].

Then acting on that delta (change in total rotation)


we will see..
p-

9
your right, I have created too many floats / vector3  / euler angles
all in every combination / local / world, All of these I am trying view and decipher in real time.

 (I keep thinking..slow time down you moron!!)

trying to decode 16 odd running vars (just for rotation), while trying to control my charatcer, in my full level??

quite interesting..I kinda needed this...I know the key is a [quaterian euler vector3 delta].

its just a little thing, but it is, like you said...a little tricky.

this is the most I have used PlayMaker...ever.

its great!~!

10
I did run across that...so target  object can be just empty game object at 0,0,0 ??

or.. how to I set his initial start postion as the 'target game object?', he's moving and changing angles constantly..so You hit space bar . this action triggers and runs,

public FsmOwnerDefault gameObject; : my Rider
public FsmGameObject target; : ????

OK, he is in the air, he has no target, landing angle will be the target for the calculation
so during update I am getting my angle of rotation, based on what, a static object??

maby I need to look at it this way...it does not matter his start rotation value.actutally this should be zeroed out, so I can get total angle of rotation while in the air.

it sounds so simple, I have to study more about 3D rotation..local/world/euler/quaterian..not my favorite thing....

Thanks!!

11
I have a characater riding a bmx bike, I am trying to score total rotation for y and X rotation:

Scenario. when my player enters the air, I am capturing vector3/quaterian/euler's from StartJump State and then again on Land OnCollide State.

SkyRyder http://skyryder.playmerc.com/v0_95.aspx

I need to find the total jump rotation in degrees. [Y sideways rotation / X up-down rotation]

I can see the quaterian displaying the right values in the Y variable..BUT how do I access quaterian.Y ??

My player hits a half pipe, rotates (up/dpwn/left/right).

Things I am scoring against:
Total Air Time with Trick Mulitipliers:
ie.

in air over 2 secs & y rotation > 175 < 185 | 180 ??
in air over 2 secs & y rotation > 185 < 359| 360 ??
in air over 2 secs & X rotation > 350 < 359| BackFlip ??
in air over 2 secs & X rotation > 350 < 359| FrontFlip ??

and when he passes the full rotation I set a new value Total 360's / Total Flips.

I am stuck and could really use some advice!

-p

12
Playmaker Tutorials / Re: Digitalwarlords PlayMaker Tutorials
« on: June 30, 2011, 08:46:36 AM »
it was a sql/mysql injection.
the admin password on your database was left as default.
the user ran a simple automated key value pair against your database IP.
and after getting in, re-set your home page header to some screwed up russian site.

this whole proccess is automated, actaully a human wrote the app.
but individual sites are comprised and modified by spiders/drones/scripts.

exact same thing happened to my dedicated server..

lock down all admin accounts/passwords and port 443. (I think thats what got me.)
also your server log will have a wealth of info..

P-

13
Playmaker Help / Re: Animation vs. Playmaker: Fight!
« on: June 30, 2011, 08:10:10 AM »
I went through hell with my models at first...
They would all snap back to 0,0,0 when playing animations..
among other wacked out behavior...
I was/am using maya -> motionbuilder pipeline..

turns out, there is the MOST important thing.

There has to be a node that is left UN-keyed..call it 'reference'
This is the node unity will use to 'Move your char/object'

if your root node has positional keys @ X,Y,Z positions,
and scripts then try to move to another position.
the animation position will always win out.

Reference (NO KEYS AT ALL)
   -root/hips(keyed)
   -abdomen/waist(keyed)
     -etc...

so now I can push out 100's of animations per character in minutes...

I will help you...send me 1 sample .fbx,
and will tell you exactly what is going on..

something I was playing with years ago..
http://forcevfx.com/motioncapture/UnivMoCap.asp

14
Playmaker Help / I am stuck...running variables / GetScript action
« on: June 13, 2011, 07:34:31 AM »
I am trying to incorporate playmaker into some existing code, I wrote a script to send some vars to FSM...

I can see the values changing at runtime, in the editor...I'm like great, I can store these values, every frame
in an upper level fsm, have that run every frame, and all other sub fsm's can get the values from that.

So I am trying to figure out why this simple concept is not working..
Is this the Global Variables issue??
ie.
I have a healthcontroller.cs running, I added a custom script, to get that value in playmaker.
I see the value, I see it changing when hit. when I assign a new playmaker health float to that value, that new float will never change on every frame, while the GetHealth action health is showing realtime values...like I have to call that script on every state, which I would rather not do.

am I missing something, I have to keep all that in code, but still puzzling..

another question, does displaying all those states, switching, have a major performance issue, while running editor, running your game, and other apps?

15
Share New Actions / AI4Enemies (asset store) GetAIController.cs
« on: June 05, 2011, 06:23:28 AM »
there a better way...DUH!!!!!!!!!!
bad idea from begininng-
there is a much better way.
why do things twice?? two sets of running vars/twice mem/cpu
have that script change state for you..

----------------------------------------------------
using HutongGames.PlayMaker; |------------HERE NEW REFERENCE


    //my NEW VARS-------------------------------------------------
    //Will Allow exact Impact Point on chars, enviroment
    //Bullet hitting wall = Dirt/Dust particle emission
    //Bullet Hitting Player/Enemy = Blood spurt/splatter
    //playmaker auto event handler
    //This will allow me full access in a third party API:auto switch states
    //***see these associated markers

    public PlayMakerFSM behavior;|------------HERE NEW 'behavior'


----------------inside running code------------------------------------


                    if (!isAttaking && !isWalkingToLastPosition)
                    {
                        //Enemy is Currently Following Waypoint Path
                        waypointModus = true;

                        //*** Start secondary AI Event Manager
                        //*** Enter 'Enemy Patrol' State

                        behavior.Fsm.Event("toPatrol"); //-----here is where you change playmaker state
                    }


this is a serious enhancment to that product.
You do not have to grab "All" the stuff I am.
be selective..
This is every frame, think of it as a bridge.
my ongoing WIP on this topic,
http://www.playmerc.com/merc_SciFiCity/

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.ScriptControl)]
[Tooltip("Grabs the current data of the AIController.")]
public class GetAIcontroller : FsmStateAction
{
[RequiredField]
public AIController getAi;
[UIHint(UIHint.Variable)]

    public FsmBool isfollowingTarget;
    public FsmEvent Following;
    public FsmEvent notFollowing;

    public FsmBool isAttacking;
    public FsmEvent attacking;
    public FsmEvent notAttacking;

    public FsmVector3 lastVisiblePosition;
    public FsmInt currentWaypoint;

    private FsmBool waypointModus;
    public FsmEvent OnWaypoint;
    public FsmEvent notOnWaypoint;

    public FsmBool isShooting;
    public FsmEvent Shooting;
    public FsmEvent notShooting;

    public FsmBool isHit;
    public FsmEvent Hit;
    public FsmEvent notHit;

    private FsmBool isWaiting;
    public FsmEvent Waiting;
    public FsmEvent notWaiting;

    private FsmBool isDead;
    public FsmEvent Dead;
    public FsmEvent notDead;

    private FsmBool isAlive;
    public FsmEvent Alive;
    public FsmEvent notAlive;

    private FsmBool isWalkingToLastPosition;
    public FsmEvent ToLastPosition;
    public FsmEvent notToLastPosition;

    public FsmFloat health;


    public bool everyFrame;

        public override void Reset()
        {
            isfollowingTarget = false;
            Following = null;
            notFollowing = null;
            isAttacking = false;
            attacking = null;
            notAttacking = null;
            lastVisiblePosition = null;
            currentWaypoint = 0;
            waypointModus = false;
            OnWaypoint = null;
            notOnWaypoint = null; ;
            isShooting = false;
            Shooting = null;
            notShooting = null;
            isHit = false;
            Hit = null;
            notHit = null;
            isWaiting = false;
            Waiting = null;
            notWaiting = null;
            isDead = false;
            Dead = null;
            notDead = null;
            isAlive = true;
            Alive = null;
            notAlive = null;
            isWalkingToLastPosition = false;
            ToLastPosition = null;
            notToLastPosition = null;
            health = 0;
            everyFrame = false;
        }

        public override void OnEnter()
        {
            isfollowingTarget.Value = getAi.isfollowingTarget;
            Fsm.Event(isfollowingTarget.Value ? Following : notFollowing);

            isAttacking = getAi.isAttaking;
            Fsm.Event(isAttacking.Value ? attacking : notAttacking);
            
            lastVisiblePosition = getAi.lastVisiblePosition;
            currentWaypoint = getAi.currentWaypoint;

            waypointModus = getAi.waypointModus;
            Fsm.Event(waypointModus.Value ? OnWaypoint : notOnWaypoint);
            
            isShooting = getAi.isShooting;
            Fsm.Event(isShooting.Value ? Shooting : notShooting);

            isHit = getAi.isHit;
            Fsm.Event(isHit.Value ? Hit : notHit);

            isWaiting = getAi.isWaiting;
            Fsm.Event(isWaiting.Value ? Waiting : notWaiting);

            isDead = getAi.isDead;
            Fsm.Event(isDead.Value ? Dead : notDead);

            isAlive = getAi.isAlive;
            Fsm.Event(isAlive.Value ? Alive : notAlive);

            isWalkingToLastPosition = getAi.isWalkingToLastPosition;
            Fsm.Event(isWalkingToLastPosition.Value ? ToLastPosition : notToLastPosition);

            health = getAi.health;

            if (!everyFrame)
                Finish();
        }
        
        
        public override void OnUpdate()
{
            isfollowingTarget.Value = getAi.isfollowingTarget;
            Fsm.Event(isfollowingTarget.Value ? Following : notFollowing);

            isAttacking = getAi.isAttaking;
            Fsm.Event(isAttacking.Value ? attacking : notAttacking);

            lastVisiblePosition = getAi.lastVisiblePosition;
            currentWaypoint = getAi.currentWaypoint;

            waypointModus = getAi.waypointModus;
            Fsm.Event(waypointModus.Value ? OnWaypoint : notOnWaypoint);

            isShooting = getAi.isShooting;
            Fsm.Event(isShooting.Value ? Shooting : notShooting);

            isHit = getAi.isHit;
            Fsm.Event(isHit.Value ? Hit : notHit);

            isWaiting = getAi.isWaiting;
            Fsm.Event(isWaiting.Value ? Waiting : notWaiting);

            isDead = getAi.isDead;
            Fsm.Event(isDead.Value ? Dead : notDead);

            isAlive = getAi.isAlive;
            Fsm.Event(isAlive.Value ? Alive : notAlive);

            isWalkingToLastPosition = getAi.isWalkingToLastPosition;
            Fsm.Event(isWalkingToLastPosition.Value ? ToLastPosition : notToLastPosition);

            health = getAi.health;
        }

}
}

Pages: [1] 2