playMaker

Author Topic: Problem with set rotation or Unity prefabs system?  (Read 280 times)

megmaltese

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
Problem with set rotation or Unity prefabs system?
« on: February 20, 2019, 07:40:25 AM »
I've got an object in the scene: when I click on it, I spawn a prefab on its coordinates, then, in another status, I set its alignment with the camera.
The prefab is a 3D arrow.

When the prefab is just the mesh, everything goes fine: the prefab spawns and gets aligned with the camera.
This means the action is working fine.
The arrow is first set pointing the same direction of the camera, then I flat down the horizontal axis so that it points "forward".

But I need the arrow to be a child of a dummy object, for animation purposes, so I put the arrow as a child of this dummy object.

But in this case, by changing exactly NOTHING except the prefab, it seems that the align functions are not working and I'm really getting mad at understanding why.
The prefab gets spawned on the object, but the rotation actions don't seem to work.

So, the prefab GETS spawned, but for some reason the rotation actions don't affect its child object that is the arrow.

Maybe this has something to do with the new Unity prefab system?

In the attachments you can see the right config, with the arrow pointing flat over the terrain, forward, in another image the wrong config, with the arrow pointing up, unaffected by the rotation actions, and the two prefabs in the scene editor in Unity.

Keep in mind that the ONLY thing I change here is the prefab in the CREATE OBJECT action field. So there should be absolutely no problem in this regard, I used this method many times in the past without any problem.
« Last Edit: February 20, 2019, 03:49:02 PM by megmaltese »

megmaltese

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
Re: Problem with set rotation or Unity prefabs system?
« Reply #1 on: February 20, 2019, 03:58:23 PM »
There, I made a video of the problem.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4106
    • View Profile
    • jinxtergames
Re: Problem with set rotation or Unity prefabs system?
« Reply #2 on: February 20, 2019, 07:44:34 PM »
Hi,
Not sure if it will help but you can try using a next frame event and then do the rotation.

megmaltese

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
Re: Problem with set rotation or Unity prefabs system?
« Reply #3 on: February 21, 2019, 02:57:01 AM »
Solved, not with your solution, but thank you!
« Last Edit: February 21, 2019, 08:51:25 AM by megmaltese »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4106
    • View Profile
    • jinxtergames
Re: Problem with set rotation or Unity prefabs system?
« Reply #4 on: February 23, 2019, 04:46:35 AM »
Hi.
How did you solve the issue?

megmaltese

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
Re: Problem with set rotation or Unity prefabs system?
« Reply #5 on: February 23, 2019, 04:04:14 PM »
It was a problem of original orientation: the export from Max had 90 degree rotation, so when I rotated the object, it pointed "forward", but the dummy created in Unity when rotated pointed UP and the difference wasn't noticeable, so I couldn't spot it immediately.
The strange thing is that I used the WORLD coordinates, so I thought this would work anywhere anytime but it didn't, very strangely...
So I exported the dummy with the linked mesh and everything was ok again.
I hope I won't meet more problem with this later on, because using world coordinates shouldn't have produced that different behavior.
You can delete this thread, I guess!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4106
    • View Profile
    • jinxtergames
Re: Problem with set rotation or Unity prefabs system?
« Reply #6 on: February 23, 2019, 08:34:04 PM »
Hi.
We never delete threads as it could also help others.
That why i also asked how you solved the issue :)

megmaltese

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
Re: Problem with set rotation or Unity prefabs system?
« Reply #7 on: February 24, 2019, 03:44:30 AM »
Ye well, that's why I suggest it could be deleted: because it didn't really solve anything  ;D ;D