Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jess84 on May 10, 2014, 10:08:15 AM

Title: Create Object action is setting 0.9999 Y Rotation transform
Post 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.
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: jess84 on May 10, 2014, 10:32:20 AM
Urgh, every single GUI object spawned with Create Object  :'(

This is going to take ages to fix up.
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: nepomuk on May 11, 2014, 01:11:01 PM
got the same problem...
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: jess84 on May 11, 2014, 02:16:10 PM
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.
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: TrentSterling on May 11, 2014, 04:30:13 PM
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.
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: jess84 on May 11, 2014, 04:33:53 PM
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 :)
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: TrentSterling on May 11, 2014, 08:10:48 PM

I think this is actually a bug in the PlayMaker action.

CreateObject.cs
Lines 51-52
Code: [Select]

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?
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: jess84 on May 11, 2014, 08:16:08 PM
Amazed that this hasn't been spotted sooner!
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: doppelmonster on March 22, 2015, 08:31:19 AM
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...
Title: Re: Create Object action is setting 0.9999 Y Rotation transform
Post by: jeanfabre on March 23, 2015, 02:25:06 AM
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