playMaker

Author Topic: a bouncing ball effect [SOLVED]  (Read 12087 times)

Loic Joint

  • Junior Playmaker
  • **
  • Posts: 76
a bouncing ball effect [SOLVED]
« on: November 15, 2011, 06:41:45 AM »
Hello,

I'm a new user of playmaker (sorry for my language, I'm french).

I try to make a game engine similar to Magic Ball 2 :


But I can't configure the bouncing effect of the ball on the obstacle like in this game. Is it possible with playmaker ?

Thank you for your help !

LOIC
« Last Edit: November 30, 2011, 10:35:37 PM by alexchouls »

Alex W.

  • Playmaker Newbie
  • *
  • Posts: 13
Re: a bouncing ball effect
« Reply #1 on: November 15, 2011, 07:26:55 PM »
Yes, ist possible.
See my actual project on my website: http://unity3d.bplaced.net/?page_id=332
« Last Edit: November 17, 2011, 06:41:24 PM by brzozowsky »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: a bouncing ball effect
« Reply #2 on: November 16, 2011, 12:53:50 AM »
Hi,

 Nice demo indeed! Wanted to comment that it's really resource intensive tho on my mac book pro ( not lion) under chrome). Maybe it's just me.

 also like very much the subtle camera movement. but would enjoy a setting to set up the movement speed ( on a touch pad it's too fast.

As for the technic you use, are you using physics or maths? cause with this kind of simple animation you can go both ways really.

 Loic ( ne t'en fait pas pour ton anglais, on comprends :) ) Have you succeed in making a script for the bal? or are you starting from scratch? If you are good with math, you can compute the bouncing angle and movement of the ball. WIth playmaker it would be quit interesting to do actually. Tho Unity comes with a really good physics engine, and you can actually achieve quit a lot of the ball interectino by simply setting up a physics environment for the ball to bounce over colliders. do you have some experience with this? In this case, playmaker also comes handy to actually detect and control the ball and various elements it hits and kill. Also with physics, you will have way more control over external interaction, say some elements comes disturbing the ball, like a an area that swirl the ball direction, or accelerate, or bounce it some weird way, etc etc, you'll be abel to build very rich interaction with ease.

 Bye,

 Jean

Alex W.

  • Playmaker Newbie
  • *
  • Posts: 13
Re: a bouncing ball effect
« Reply #3 on: November 16, 2011, 11:24:38 AM »
I use custom physic for the bouncing.
Small tutorial for perfect bouncing:

First you must edit the global physic under EDIT -> Project Settings -> Physics:


Second the Fixed Timestep under EDIT -> Project Settings -> Time:


And now the Ball:
-Sphere collider and Rigidbody:


and the Ball FSM:


at last, you must set the tag "wall" to all walls in the scene and the tag "stone" to your stones.

The ball speed you can modify with the variable "first_speed". set it to 3 for normal speed.
« Last Edit: November 16, 2011, 11:47:34 AM by brzozowsky »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: a bouncing ball effect
« Reply #4 on: November 16, 2011, 07:53:10 PM »
Excellent!, thanks for sharing these valuable infos

bye,

Jean

Loic Joint

  • Junior Playmaker
  • **
  • Posts: 76
Re: a bouncing ball effect
« Reply #5 on: November 17, 2011, 04:01:35 AM »
Thank you verry much for this very usefull help !

@ brzozowsky
Very good web game, the shader is a very good idea. Thank you for the screen shot and detailed explications, is it perfect for à beginner like me.

@ jeanfabre (tiens, un compatriote francophone ? ^^)
I was used a Unity script fonded on the web who work correctly,  but I prefere use playmaker to explore his capacities. Thanks you for they informations about the possibility of playmaker.

Loic Joint

  • Junior Playmaker
  • **
  • Posts: 76
Re: a bouncing ball effect
« Reply #6 on: November 17, 2011, 05:57:54 AM »
I have tested but the ball is static at the start of the scene, all variable is 0 value in the inspector after start (the first speed to). I have created a new scene and configured Unity as your screen shot, and create the same FSM for the ball :









The scene after pressing play :



I have see you use a specific physic material for the ball ?

Alex W.

  • Playmaker Newbie
  • *
  • Posts: 13
Re: a bouncing ball effect
« Reply #7 on: November 17, 2011, 12:29:15 PM »
Yes, here is the Physic Material for the ball:


And for the first ball speed add the value to the "first_speed" variable in the ball FSM:
X: 0
Y: 0
Z: -3
« Last Edit: November 17, 2011, 01:01:37 PM by brzozowsky »

Loic Joint

  • Junior Playmaker
  • **
  • Posts: 76
Re: a bouncing ball effect
« Reply #8 on: November 18, 2011, 03:56:05 AM »
Thank for the material, that work ! But the "first_speed" is a float ? I can't enter a vectorial value into it. I'have juste unchecked the float operator of the first state and remplaced "first_ball" in Z by 3.

Thank you for the help and good luck for your games ^^

Alex W.

  • Playmaker Newbie
  • *
  • Posts: 13
Re: a bouncing ball effect
« Reply #9 on: November 18, 2011, 06:37:01 AM »
The "first_speed" is a vector3 variable. Of course, you can enter a value without the predefined vector3.

Loic Joint

  • Junior Playmaker
  • **
  • Posts: 76
Re: a bouncing ball effect
« Reply #10 on: November 18, 2011, 09:00:04 AM »
Ok, but in the first state of your FSM, the "first_speed" variable is stored as a float value (float operator and Set velocity). This is possible ?

Alex W.

  • Playmaker Newbie
  • *
  • Posts: 13
Re: a bouncing ball effect
« Reply #11 on: November 18, 2011, 09:02:30 AM »
Yes, you can add the value "-3" to the "first_speed" float in the second state.
« Last Edit: November 18, 2011, 09:04:22 AM by brzozowsky »