Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: jess84 on May 10, 2014, 10:08:15 AM
-
I'm using Create Object to spawn various prefabs during my levels, and leaving 'Rotation' blank - however all objects are being spawned as Rotation: X=0, Y=0.9999, Z=0.
Objects that are just in my scene are normal, all 0,0,0 rotation.
Any ideas why this is happening? Do I actually have to set the rotation field for all of my Create Object actions to stop this happening?!
Edit: Just to clarify - all of my prefabs in my hierachy are 0,0,0 before they're spawned.
It's very subtle and I only noticed it when tracking down why my pixel offsets for GUI texts weren't acting like they were supposed to.
-
Urgh, every single GUI object spawned with Create Object :'(
This is going to take ages to fix up.
-
got the same problem...
-
Unlucky :)
It's such an annoying little thing, and not something that's not visually obvious, I mean - 1 degree. I spent ages in the past messing around with pixel offset values and wondering why it wasn't translating to what it should onscreen - driving myself crazy over very basic maths seemingly not working.
-
My suggestion is to copy the 'create object' action and add a transform straightening bit to the code. Name it something like 'Create Object Straight'. I'm surprised that it's giving you those non-snapped numbers. Some kind of floating point imprecision.
-
Urgh, that's a good idea... unfortunately I finished going through them last night. Some on my Create Actions, and when there were too many actions calling a few gameobjects I added a Transform Rotation on the object FSM. Wish I'd thought of your method :)
-
I think this is actually a bug in the PlayMaker action.
CreateObject.cs
Lines 51-52
var spawnPosition = Vector3.zero;
var spawnRotation = Vector3.up;
Setting spawnRotation to Vector3.zero fixes the bug. I just started a blank project, and with the original code, we get 0.99999
Setting it to zero gets 0 rotation across the board.
Why in the world wouldn't it be zero?
-
Amazed that this hasn't been spotted sooner!
-
amazed that this is still not fixed in 1.78. I just filed a bug report.
Very annoying to keep track of faulty basic actions...
-
Hi,
yeah, that's odd, I covered that (http://hutonggames.com/playmakerforum/index.php?topic=5084.0) a long long time ago :) I'll mention this to Alex again.
Bye,
Jean