Forum rules - please read before posting.

1.47b NPC problem

hi everybody!

i'm still struggling with the unity5 + AC update... The pathfinding issue I had seems to be somewhat resolved (still not as good as in the unity4 prototype), but now, since the most recent update I have problems with my NPCs as well.

the ants (which run through the set) are controlled by a simple custom playmaker AI, but I used the NPC script to have the spriteanimation / angles taken care of. Correct me if i'm wrong, but didn't the NPC script align the sprite to face the camera? At the moment it doesn't unfortunately.

(when i open a backup the NPC scripts have little enable/disable checkboxes, in my new project they haven't. the new one also autoadds a Paths script, the old one didn't.. is my install broken? the rest seems to work so far)

I've looked into the align to camera script, but this script needs a specific camera, and I need it to work with the mainCamera. Then I've used playmaker to align it, which worked, but screwed up the angle/sprites..

is this a bug, or do I need to change the NPC to work with the newest AC or something?

any thoughts? thanks!

Comments

  • It's hard to give much advice without seeing what's happening, exactly.  The Paths is added automatically by way of convenience, you can ignore that.

    The only change made to the core system due to Unity 5 was that Hotspot colliders need to be placed on the sprite child, but rotation should be unaffected.

    NPC sprites should still face the camera: the sprite child, that is.  The root object won't.  You can test a 2D sprite in a 3D environment easily by running the 3D Demo with the 2D Demo's player prefab (Brain2D) present in the scene before you run it.
  • i've added Brain2D to my testscene, replaced the player script with the npc script, replaced the 2d rigidbody and collider with 3d ones, changed the tag and layer to 'NPCs'....

    when i move my main character through the scene, the sprite child doesn't align to the camera - stands completly still...

    does this work for you? thanks!

    PS: the main character works as expected.
  • The tag and layer are irrelevant, so long as the tag isn't Player.  You've set up the NPC component values to the same as they were in the Player component, and are moving the character using Actions?

    If so, PM me the prefab.
  • yes, I matched the settings of the Brain2D player script values, but I don't move the character at all, just flying with the cam from left to right...

    when i press play, the "front sprite" of Brain gets displayed on the NPC sprite, but the sprite child of brain doesn't align with the moving camera.. (means it doesn't rotate in 3d space to align to the camera)

    Unity 5.1.1f1 AC 1.47b
  • What's your "Camera perspective" set to in the Settings Manager?  If you want the sprite to rotate dynamically with the camera, it'll need to be set to 3D.
  • unfortunately it is set to 3D... i toggled it to 2d and back to 3d, without any effect, the sprite doesn't align. does the alignment work for you when you drop the brain2d npc I sent in a 3d scene? (static npc, moving camera)

    it does work in the old project with an older AC.... maybe something changed for the VR camera or UFPS (or whatever its called) support? or maybe my update went south (but i have no errors, and the rest seems to work as expected...)?

    as far i can tell the sprite of the main character does not align either, but since the camera is following closely this is not a big issue (at least in my case).....
  • I don't have your prefab to hand - it'd be best for you to PM it to me so that we're both sure we're using the same one.

    Testing with the Brain2D Player prefab, which I've been doing in the 3D demo, should have identical behaviour, however.  But this is the first time you've mentioned VR - is your game making use of that?
  • VR? no, I was just mentioning it with the hope to get to the root of the problem earlier or at all ;) . Maybe something changed due the enhanced camera / plugin support?

    I've PMed a dropbox link to the modified brain2d as NPC to you quite some time ago.... didn't you recieve it?
  • @ChrisIceBox

    I get the feeling we are talking about different things... I was talking about something like this:
    https://www.dropbox.com/s/f2xwm69phq844ly/align_to_3dCam.gif?dl=0

    I solved it with playmaker (still have the problem that the NPC script seems to stop working when i instantiate the gameobject... but this could be on my side, I'll have to investigate first...

    I don't know why everything worked in my Unity4 prototype, though...
  • That is indeed what I've been talking about.  But be aware that the sprite will rotate in accordance with the camera's rotation - not it's position.  Could this be the difference?

    NPCs are updated through the StateHandler script, to maximise performance, so they need to be added to the script's internal record once instantiated.  This occurs automatically if you use the "Object: Add or remove" Action, but if you do this manually - you'll have to run StateHandler's GatherObjects function.
  • yes could be.. but wouldn't it make more sense to align the spritechild (lookat) to the camera instead of 'cloning' the rotation of the camera? or this is a 2D or 2.5D necessity? anyway I can get by using playmaker i guess, just wondering...

    thanks for the gatherobjects function! works like a charm
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.