Hey Chris,
I've just started using Adventure Creator and I can't believe how good it is! Thank you so much for it!
I'm having a problem with the Player character in a 2D point and click game. The root object rotates whenever I click to move, even though the scene is set to Unity 2D and the character is using "Sprites Unity" for the Animation Engine. It seems to rotate to try to face wherever I clicked instead of keeping the sprites facing the camera.
I've looked through the tutorials for creating 2D characters and I believe I have all the settings correct, but I'm not sure what else it could be. Oddly enough, I also have an NPC who animates correctly and doesn't rotate away from the camera. So it's just the Player that has the problem.
Hopefully there was something simple I missed! This might not be enough information so I can post a screenshot with my settings too if necessary.
Thanks for you help!
Comments
any custom scripts on the player?
whats your camera perspective set to in settings manager?
(nick)
Otherwise, post a screenshot of your Player prefab (in-game) and Inspector.
I don't have any custom scripts on the player except for a free addon called "Sprites and Bones" which just adds IK bones for my characters' legs. I was thinking this was the problem, but my NPC has the exact same set-up and seems to work fine, so I'm confused!
The sprite child is assigned properly, as far as I know! Here's an image which includes a few different things - the prefab in game, the hierarchy, and the child of the prefab in the inspector. I hope this helps!
http://imgur.com/PuSIQXX
Thank you for your help!
the player script is meant to zero out rotation when in 2d mode,
cool character btw !
I tried unchecking the scripts, they don't make any difference. I'm not sure what else it could be!
for me the rotation values on the parent prefab don't effect the sprite child graphic when in play mode
maybe try removing the player component and adding it again
I have to do this whenever I switch between Sprites Unity and Sprites Unity Complex modes
Failing that - if your NPC is working correctly, then there must be some difference, however small, between the NPC and Player. Have another look at both to see if it's any clearer what that is.
Same problem here, but my player start "rotating" because I've unchecked "isTrigger" on the collider attached to the root object.
@nova1337 Let's see screens of your character's Inspector, as well as details of when exactly the issue occurs.
Try unchecking Turn root object in 3D? in the Inspector. Also be aware that a Rigidbody component is not strictly necessary on a 2D character unless you want wall collisions when moving around using the "Direct" movement method.
@ChrisIceBox See attachment.
https://ibb.co/h7py3VT
It happens when I switch the player. Even if I cannot say exactly what triggered this event. I'm trying to remove RB because I don't need wall collision. Thx
Removing Rigid Body solved the issue.
Yes, you'll get better performance too without a RB component.
Likely you can also remove the Box Collider too. In general, you should add a small Circle Collider 2D by their feet (set to Is Trigger) to aid with character evasion - and leave any Box Collider (for Hotspot interactions) on the sprite child.
See the 2D Demo's Brain2D prefab for an example on how the Circle Collider 2D can be set up on a Player prefab.