Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Alppa on December 31, 2012, 09:01:33 AM

Title: New Vector3 Help![SOLVED]
Post by: Alppa on December 31, 2012, 09:01:33 AM
Hi guys im new in playmaker and i have try to make this code work in playmaker but i dont know how, can someone help me plz!

Code: [Select]
void Update () {
if(Input.GetButtonDown("Jump")){
rigidbody.velocity = new Vector3( 0,speed * Time.deltaTime, 0 );
}
]

I know how to set        -->           if(Input.GetButtonDown("Jump").

But i dont know how to set --->      rigidbody.velocity = new Vector3( 0,speed * Time.deltaTime, 0 );

Tnx :)
Title: Re: New Vector3 Help!
Post by: MajorIdea on December 31, 2012, 10:57:22 AM
The first is easy. Just have a state that listens to the input Get Button Down (in the Action browser) and has a transition (called buttondown for example) that leads to another state with the rigidbody stuff. Maybe a Set Velocity in the Physics tab of the action browser and then pick the object with the rigidbody.

Hope that helps, playmaker is awesome!
Title: Re: New Vector3 Help!
Post by: Alppa on December 31, 2012, 11:21:56 AM
Thank you MajorIdea very much, it work!!  ;D

Title: Re: New Vector3 Help!
Post by: kiriri on December 31, 2012, 11:37:20 AM
any public variable in any script can be exposed in Playmaker by dragging the component from the inspector into Playmaker's state panel, where you'll get a prompt asking you whether you want to set or get a specific variable. In your case, just use SetProperty and the velocity should appear in the dropdown.
you cannot instantiate a new vector3, except if you use hashtables with ArrayMaker.

The action TimeInfo can give you deltaTime. then use float operator or float multiply to get a float that fgits your Y coordinates. Then create a vector3 and use a set vector3 XYZ action to make it 0/float/0.