playMaker

Author Topic: New Vector3 Help![SOLVED]  (Read 2638 times)

Alppa

  • Playmaker Newbie
  • *
  • Posts: 8
New Vector3 Help![SOLVED]
« 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 :)
« Last Edit: January 01, 2013, 08:33:55 AM by jeanfabre »

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: New Vector3 Help!
« Reply #1 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!

Alppa

  • Playmaker Newbie
  • *
  • Posts: 8
Re: New Vector3 Help!
« Reply #2 on: December 31, 2012, 11:21:56 AM »
Thank you MajorIdea very much, it work!!  ;D


kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: New Vector3 Help!
« Reply #3 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.
« Last Edit: December 31, 2012, 11:41:22 AM by kiriri »
Best,
Sven