Hello, I just started using Adventure Creator and I am trying to create an adventure game where the characters are 2D sprites on 3D geometry. I'd like the sprites to always face the camera and this appears to be controlled within Player > Standard 2D animation > Rotate sprite to : Camera Facing Direction. However, when I made my character and set this up properly the character does not rotate to face the camera. While playing the game in editor if I change Rotate Sprite to : Relative Position of Camera and then back to Camera Facing Direction it then properly rotates the player to the camera. I am wondering if there is a bug in how this code updates or if I have set it up incorrectly?
Here is what I'm working with:
Unity 5.3.6f1
AC 1.53
I have a 3D project setup via the new project wizard and created a player via the character wizard. The player animations setting are set to:
Animation Engine: Sprites Unity
Motion Control: Automatic
Sprite Child: characterSprite
Idle name: idle
(no other animations set)
Multiple directions? No
Crossfade animation? No
Only move when sprite changes? No
Rotate Sprite To: Camera Facing Direction
The sprite child is setup with a sprite rendere and an Animator with a Controller that only has an 'idle' animation.
I then play the game using a the Main Camera and GameCamera that has its X and Y axis unlocked. I have a simple flat plane to test the character walking on top of.
With all this setup the character will not be rotated to face the camera on start. I also tried switching the camera via a trigger volume and noticed the character also does not update to the rotation of the new camera.
I believe I tracked the character sprite rotation code to line 2315 in the Char.cs script and it appears to be finding the proper camera transforms so I don't understand why it would not properly rotate the sprite.
Anyway, hopefully I'm just setting something up wrong, any help would be greatly appreciated!
Comments
The set-up you've described all sounds correct. Normally this'll be down to the Camera perspective in the Settings Manager not being 3D, or their being more than one MainCamera in the scene, but they don't seem to be the case here.
Check that the "idle" animation you've created doesn't key the rotation of your sprite child. The code you've come across in Char.cs affects the sprite child's rotation directly, so if your animation also controls it then there'll be a conflict.
Failing that, we'll need to determine if this is an issue with the character, or the scene. Try dropping the 2D Demo player prefab, found in /Assets/AdventureCreator/2DDemo/Resources/Brain2D, into the scene before running it and then test the scene. If he works OK there, we'll know the problem lies with your character.
If that doesn't work, try dropping your own player prefab into the 3D Demo scene, found in /Assets/AdventureCreator/Demo/Scenes/Basement. Unset the "OnStart" Cutscene field in the Scene Manager so that you skip straight to the gameplay when you run the scene, and see if your player works correctly there. If he works OK, we'll know the problem likes with your scene.