playMaker

Author Topic: Create Object action is setting 0.9999 Y Rotation transform  (Read 3335 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
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.
« Last Edit: May 10, 2014, 11:18:33 AM by jess84 »

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #1 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.

nepomuk

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #2 on: May 11, 2014, 01:11:01 PM »
got the same problem...

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #3 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.

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #4 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.

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #5 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 :)

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #6 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?
« Last Edit: May 11, 2014, 08:14:21 PM by TrentSterling »

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #7 on: May 11, 2014, 08:16:08 PM »
Amazed that this hasn't been spotted sooner!

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #8 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...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Create Object action is setting 0.9999 Y Rotation transform
« Reply #9 on: March 23, 2015, 02:25:06 AM »
Hi,

 yeah, that's odd, I covered that a long long time ago :) I'll mention this to Alex again.


 Bye,

 Jean