Playmaker Forum

PlayMaker News => General Discussion => Topic started by: PolyMad on February 20, 2019, 09:40:25 AM

Title: Problem with set rotation or Unity prefabs system?
Post by: PolyMad on February 20, 2019, 09: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.
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: PolyMad on February 20, 2019, 05:58:23 PM
There, I made a video (https://youtu.be/fCf1VL1EQHY) of the problem.
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: djaydino on February 20, 2019, 09:44:34 PM
Hi,
Not sure if it will help but you can try using a next frame event and then do the rotation.
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: PolyMad on February 21, 2019, 04:57:01 AM
Solved, not with your solution, but thank you!
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: djaydino on February 23, 2019, 06:46:35 AM
Hi.
How did you solve the issue?
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: PolyMad on February 23, 2019, 06: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!
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: djaydino on February 23, 2019, 10:34:04 PM
Hi.
We never delete threads as it could also help others.
That why i also asked how you solved the issue :)
Title: Re: Problem with set rotation or Unity prefabs system?
Post by: PolyMad on February 24, 2019, 05:44:30 AM
Ye well, that's why I suggest it could be deleted: because it didn't really solve anything  ;D ;D