playMaker

Author Topic: playmaker physics (fruit ninja)  (Read 4005 times)

khrius86

  • Playmaker Newbie
  • *
  • Posts: 7
playmaker physics (fruit ninja)
« on: March 29, 2014, 05:48:30 AM »
What would be the best way to throw items into the air (like in fruit ninja)?

Tomshask

  • Playmaker Newbie
  • *
  • Posts: 1
    • Ծաղիկներ
Re: playmaker physics (fruit ninja)
« Reply #1 on: March 29, 2014, 09:22:00 AM »
fruit ninja great game , if will be great if I could make something like it with playmaker .

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: playmaker physics (fruit ninja)
« Reply #2 on: March 29, 2014, 11:42:51 AM »
An object with a rigidBody and gravity on. This action - addForce. Try setting the X to something like 4, Y to 10, and z to 0 and change the Force to Impulse. Play around with X and Y to get what you need but impulse doesn't require a lot to get it moving.

http://docs.unity3d.com/Documentation/ScriptReference/ForceMode.html
to see more about forceMode
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

khrius86

  • Playmaker Newbie
  • *
  • Posts: 7
Re: playmaker physics (fruit ninja)
« Reply #3 on: March 29, 2014, 11:45:55 AM »
sebaslive, thanks a lot buddy. is there any way to affect the speed? for example if i want to re-create a "slo-mo" mode
« Last Edit: March 29, 2014, 12:14:48 PM by khrius86 »

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: playmaker physics (fruit ninja)
« Reply #4 on: March 29, 2014, 12:24:22 PM »
you can literally slow down the whole game by using the action Scale Time

https://hutonggames.fogbugz.com/default.asp?W95

Or by lowering the gravity, might work? Worth a try.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

khrius86

  • Playmaker Newbie
  • *
  • Posts: 7
Re: playmaker physics (fruit ninja)
« Reply #5 on: March 29, 2014, 12:54:44 PM »
Okay that will work for basic tests, i have the basics up and running, placeholder fruit thrown into the air and they come back down, only problem is figuring out how to re-spawn them and also control the volume of fruit the game throws up.

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: playmaker physics (fruit ninja)
« Reply #6 on: March 29, 2014, 02:36:59 PM »
if you have any questions about it just reply here
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

khrius86

  • Playmaker Newbie
  • *
  • Posts: 7
Re: playmaker physics (fruit ninja)
« Reply #7 on: March 30, 2014, 12:41:20 PM »
I'm having a hard time figuring out the best and most efficient way to spawn the fruit, in fruit ninja, there are multiple copies of the same fruit on screen at once too.

i need something off-screen that spawns and chucks out fruit, the last part has been solved by using force, but having the items spawn randomly is an issue.

not only spawn randomly, but to also know that at the start of the game, only spawn a few at a time, as time goes on spawn more so that the game gets more hectic.

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: playmaker physics (fruit ninja)
« Reply #8 on: March 30, 2014, 01:30:51 PM »
Right, so I just finished doing something like this as well in my last game which would increase in difficulty based on score since the player has to increase the score anyways. So when the score got to 30 I would compare float and if greater than 30 it would increase the difficulty. I would then have an empty gameObject and call that my game manager which was controlling the difficulty in one FSM and score in another. So in the score FSM when it gets past 30 I would send an event to the difficulty FSM in the same object and to increase difficulty by going to a new state that would send faster objects.

So in this new state I designated level2, I would set the float of speed to a higher number to increase the rate at which the objects would appear. So if you are using a wait function between spawning your fruits you would make that number a variable so you can change later once the difficulty increases.

To make it spawn randomly you can also use the action Random Float. in random float you can set the min and max but you can also set these to your own variable that you can change later in another state to either make it more random or less random. Try these out and you will get a whole new level of understanding to creating random objects!

Later on you can get to learning how to pool these objects for optimization!
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

khrius86

  • Playmaker Newbie
  • *
  • Posts: 7
Re: playmaker physics (fruit ninja)
« Reply #9 on: March 30, 2014, 01:46:01 PM »
thanks so much, i have all the reference i need to finish the game now, just a few more art assets (which im actually good at, unlike playmaker) and im good to go, thanks for getting me on the right track!