Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: cel on January 31, 2019, 08:07:40 AM

Title: actions for the new physics update
Post by: cel on January 31, 2019, 08:07:40 AM
Hi,

Would it be possible to get actions for the new physics update, like for example the PhysicsScene methods and maybe a tutorial about simulations??

Thanks
Title: Re: actions for the new physics update
Post by: jeanfabre on February 01, 2019, 04:37:47 AM
Hi,

 It's a very new feature and I have trouble understand what it brings on the table. What do you think it will help you achieve that you can not achieve already?

If you have some links, I'll study them.

Bye,

 Jean
Title: Re: actions for the new physics update
Post by: cel on February 01, 2019, 06:07:45 AM
What I had in mind was the trajectory simulation as seen here is the pool example video:

https://blogs.unity3d.com/2018/11/12/physics-changes-in-unity-2018-3-beta/

and the only docs I could find:

https://docs.unity3d.com/2018.3/Documentation/ScriptReference/PhysicsScene.Simulate.html
Title: Re: actions for the new physics update
Post by: jeanfabre on February 04, 2019, 01:32:19 AM
Hi,

 that sounds very cool, but without a clear working sample, we are going to struggle... the quick code snippet in the doc raises many questions.

I'll try to see if I can find a working sample by the dev team, If you stumble upon one, bump this thread :)

Bye,

 Jean

Title: Re: actions for the new physics update
Post by: cel on March 04, 2019, 03:38:47 AM
will this help?

Title: Re: actions for the new physics update
Post by: jeanfabre on March 05, 2019, 12:02:08 AM
Hi,

 nice, that will do indeed. I'll start tackling this. I don't expect to have the time to finish it before end of march, so make sure you bump me the last week of march to make sure I am on it :)

 Bye,

 Jean
Title: Re: actions for the new physics update
Post by: cel on March 30, 2019, 06:26:50 AM
A friendly bump
Title: Re: actions for the new physics update
Post by: jeanfabre on April 01, 2019, 04:14:30 AM
Hi,

 yes, I have planned to work work on this, I need to first finish pun 2 support for end of april, as there is a talk in asia that will use this, once I am done with that I'll tackle this.

 Bye,

 Jean
Title: Re: actions for the new physics update
Post by: cel on April 22, 2019, 07:37:25 AM
Any news on this?
Title: Re: actions for the new physics update
Post by: cel on May 13, 2019, 04:06:15 AM
thought this could be helpful as well:

Title: Re: actions for the new physics update
Post by: cel on May 17, 2019, 03:51:07 AM
bump
Title: Re: actions for the new physics update
Post by: jeanfabre on May 20, 2019, 03:28:04 AM
Hi,

 I am currently overloaded, but it's still something I want to do eventually, so please keep bumping, It's not being ignored :) just post pone unfortunately.

 Bye,

 Jean
Title: Re: actions for the new physics update
Post by: cel on May 27, 2019, 03:39:04 AM
bump
Title: Re: actions for the new physics update
Post by: cel on May 30, 2019, 06:26:34 AM
found another tutorial that might be useful

https://physics-labs.com/2019/04/01/physicsscene-simulate/
Title: Re: actions for the new physics update
Post by: kaniballo on May 30, 2019, 07:04:38 PM
,... i'm not expert not programmer also,... but i'll try to explain/contribute,.. forgive me if ,... :)

1. Create Physic Scene by Name with turn off auto-simulation (from attachment),...  Create new scene (Local Physical Scene) - parallel on main/default scene,... created new scene is added additively at runtime i.e pop-up in Hierarchy i.e if you stop Play newly created Local Physical Scene disappear,...

2. Auto Simulation On Off (attachment) control when main/default Unity scene will receive physic,... Auto Simulation On is for Default Unity Scene Only,... newly created Local Physical Scene has other form of control - Physics Scene Simulation,...

3. Physics Scene Simulate On Off (attachment) - control when Local Physical Scene
receive physic,... it's bool variable who check every frame - tick on simulation begun,... tick off simulation stop.
,... again i'm not a programmer and this Actions may be not good or they are "green inside",... :)

,...example how to use ,...
1. Create Plane Scale 10x1x10 to use as floor name Floor Local Physical Scene 1
2. Duplicate Plane/floor with name Floor Local Physical Scene 2
3. Create Box to use as wall put him perpendicular on floor name Wall Local Physical Scene 1
4. Duplicate box/wall with name Wall Local Physical Scene 2
5. Create Sphere (add Rigidbody Component) with name Ball Local Physical
 Scene 1
6. Duplicate Sphere/ball name Ball Local Physical Scene 2

on Playmaker side,... Create new FSM on empty game object,...
1. create new state and put there Create Physic Scene (from attachment),... give name - Local Physical Scene 1 (will pop-up on runtime)
2. again in same state Create Physic Scene (from attachment),... give name - Local Physical Scene 2 (will pop-up on runtime)
 ,... (little explanation - We must put some objects for physical simulation in newly created two Local Physical Scenes,... we have 2 floors two walls and two balls, but they are in default/main Unity scene - again we must put them in Local Physical Scenes, if objects that we created are in hierarchy (root) we can move straight ahead with (Move Game Object To Scene Action) from default Playmaker actions ,... if objects who need to move to Local Physical Scenes are prefabs - we must use (Create Object) action again from default Playmaker,..
3. Again in same state create Move Game Object To Scene Action - 3 times,... move once floor ,... then box ,... and sphere,.. use scene reference by name and don't use any events from result (we need only to move objects  to physical local scene 1) ,...
4. again in same state Move Game Object To Scene Action - 3 times,... move flor,bos,sphere 2 to local scene 2,... put Finish transition and create new state,..
6.  in new state create two time Physic Scene Simulate (from attachment)
set them as local scene 1 and local scene 2 (if you wish set different time scale)
,...less then 1 physic simulation slow ,... more then 1 get speed,...
7. in same state add two default playmaker actions (Add Force) set them corresponding to Spheres/Balls 1 and 2 set x0,y15,z15 (or vector/force where is wall) set force to impulse.
 that is all about setup ,.. is little long :)
,... after play you will see one sphere/ball (actually two in one - put them to spawn separately) moving from add force impulse to wall,... potentially with different slow/fast effect,... completely independent from one other  ,.... :)
 ,... Conclusion what we have - 3 completely independent from one other physical scenes (default/main need autosimulation on + 2 local physical scenes)- with independent physical steps,... if you wish trajectory get position from one physical scene ball put in array/list and spawn/instantiate many small(trajectory mark) in those positions,... i hope someone help ,... and sorry for long explanation :)
Title: Re: actions for the new physics update
Post by: cel on June 04, 2019, 03:49:02 AM
Thanks for your help kaniballo, but I can't get to work, well, to show the trajectory... is there any chance you could share an example showing how to display the trajectory, that would be much appreciated ,

Thanks in advance
Title: Re: actions for the new physics update
Post by: cel on June 05, 2019, 03:38:49 AM
I've been playing with this again, and I have a question, on step 2 (playmaker side), do we really need to create 2 local physics scenes? I was under the impression that we only needed to create one physics scene on the main scene and move the duplicated objects into it, please correct me if I am wrong.

It seems I am stuck with this, I can't really tell if this is working or not, I see the ball move and act accordingly but I can't setup it so I can see the trajectory.

Once again, any help would be appreciated
Title: Re: actions for the new physics update
Post by: kaniballo on June 09, 2019, 10:51:08 AM
hi,... and sorry for wait response ,....  here is one combined action for trajectory type mouse click fire ammo ,... https://hutonggames.com/playmakerforum/index.php?topic=20649.msg90580#msg90580 ,.. i hope will help,... :)