PlayMaker Help & Tips > PlayMaker Tips & Tricks
How to rotate skybox with Playmaker
(1/1)
Baer:
How to rotate skybox with Playmaker
Easy, cheap and quick
Hi, everyone.
In my mobile game I want more live actions with objects and environments, but with less hardware requirements. One of my case – rotate standard 6-sided skybox with integrated “rotate” slider. Sounds simple, looks cute and works well even on old devices.
And how do it with lovely Playmaker?
* Create empty object, let’s give him name “SkyboxRotate”;
* Attach “Mesh Renderer” component on it;
* Create FSM on it, add first start state, add transition “FINISHED”, and add action “Set material float”;
* First, we need zero rotation from start, so - in action properties: Game object – Use Owner, Material Index – 0, Material – here you must attach your Skybox material, Named Float - _Rotation, Float Value – 0;
* Next create new state, add same transition “FINISHED” and copy yours “Set material float” action in;
* Create variable, type – float, name – whatever, in my example – “SkyboxRotate”;
* In second state on “Set material float” in float value pick ours new float “SkyboxRotate” and check “Every Frame” box;
* Add here new action “Ease Float”, From Value – 0, To Value – 360, Float Variable – pick “SkyboxRotate”, Time – for me optimal was 1000, Finish Event – FINISHED;
* Finally for loop just link second state on himself, run and enjoy 8)
FSM screenshot
State 1 screenshot
State 2 screenshot
Live sample (14mb gif, Time set to 500)
You can create your own Skybox-material with code or with shader tool like Shader Forge, uShader etc. and interact with it with this simple trick.
Hope, my small guide will be useful for someone :)
jeanfabre:
Hi,
Cool, thanks for this, but one thing.
maybe you should not loop a state using a finish transition and instead set your actions to "everyFrame".
can you confirm this for your rotating fsm?
Bye,
Jean
Navigation
[0] Message Index
Go to full version