Search Unity

UFPS : Ultimate FPS [ RELEASED ]

Discussion in 'Assets and Asset Store' started by VisionPunk, Mar 9, 2012.

Thread Status:
Not open for further replies.
  1. BrandSpankingNew

    BrandSpankingNew

    Joined:
    Nov 20, 2012
    Posts:
    220
    Examine MouseCursorZones in vp_FPInput (in the Inspector I mean). Take a look back at the demos and see how the zones are setup there (I'm not looking at the demos and just "remembering" it, but I think that Zones were used there ... anyhow, that MouseCursorZone thing works like a champ and will solve your problem).
     
    Last edited: Dec 11, 2013
  2. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    Thanks for the hint with the MouseCursorZones. I tried setting one up before and it didn't work properly in the editor. (The mouse cursor that should've been deactivated by Playmaker kept flickering around on screen.) However I didn't get this issue in the standalone game now that I tested it there, so I'll just use this solution. :) I've changed the mouse cursor toggle in the script from Return to Escape, so perhaps that's why it is working well now.
     
  3. Quixotic7

    Quixotic7

    Joined:
    Jul 7, 2013
    Posts:
    10
    Hey VisionPunk, I bought your UFPS asset and am loving it! I got working with a full body character with Hydra controlled Hands and the Oculus Rift and I made my own version of your input controller to handle Razer Hydra controllers!

    I've run in to a few strange problems though that may have have already been answered in this thread, but I'm not finding anything via searching.

    First problem: Having a full body, I have to parent it to the body and not the camera because I only want it to rotate on the Y axis. Doing so though, causes some crazy shaking, I can get rid of the shaking by switching 'm_Transform.position = FPController.SmoothPosition;' to 'm_Transform.position = FPController.transform.position;' but then I don't get the smoothing feature. Is there a better way to get around the shaking problem?

    Another option instead of parenting the body to the playerController is to parent it to the camera and then set the Y sensitivity to 0. Then parent the OVR Camera to the Camera, and this works fine, except I can't remove the original camera from parent object as the script depends on it, though I could disable it in the script. I also like being able to control the body and camera dual joystick when not using the Oculus, in which case I like being able to look up and down, so I would need to add a regular Camera that's Pitch Rotation is controlled separately, or I could hack in support in to the Camera script.

    What do you think is the best method for adding a full body with motion controlled hands to the setup?

    Second Problem: This is minor, but I still find it troubling. I can't figure out how to allow the player to jump while running. on the CanStart_ callback I can see it won't allow you to jump while crouching is enabled, but I can find nothing about preventing you from jumping while running. Any ideas how to make that work?

    Thanks for your help, and thanks for making this awesome asset!
     
  4. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I cannot get control of the UFPS mouse/control without a number of clicks. I want to begin the game, click start, and have Screen.LockCursor active. There is always an extra click. I know you need to click in the webplayer to have access, but I cannot combine that with activation UFPS. Here is some of the code.

    Code (csharp):
    1.     //-----ufps-----
    2.     private vp_FPController controller = null;
    3.     private vp_FPCamera camera = null;
    4.     public GameObject advancedPlayer;
    5.  
    6.     void Awake()
    7.     {
    8.         instance=this;
    9.  
    10.         controller = GameObject.Find("AdvancedPlayer").GetComponent<vp_FPController>();
    11.         camera = GameObject.Find("FPSCamera").GetComponent<vp_FPCamera>();
    12.  
    13.         Screen.lockCursor = true;
    14.  
    15.         advancedPlayer.SetActive(false);
    16.     }
    17.  
    18.     void Update()
    19.     {
    20.         if(Input.GetMouseButtonDown(1))
    21.         {
    22.             OnRightClick();
    23.  
    24.             controller.SetState("Freeze", true);
    25.             camera.SetState("Freeze", true);
    26.         }
    27.     }
    28.  
    29.     void OnRightClick()
    30.     {
    31.         Debug.Log ("right click");
    32.         Screen.lockCursor = false; 
    33.         window1.enabled = true;        
    34.     }
    35.  
    36.     public void button4_Click(iGUIButton caller)
    37.     {
    38.         panel1.enabled = false;
    39.         _camera.enabled = false;
    40.         advancedPlayer.SetActive(true);
    41.     }
    My current attempt is to activate the gameObject when you click start, I was sure that would fix it. I'm trying to get rid of the mouse cursor active, and UFPS while i'm in the star menu.

    Below is a link to a webplayer.

    http://www.topofsteel.com/Unity/12-13-13/12-13-13.html
     
  5. BrandSpankingNew

    BrandSpankingNew

    Joined:
    Nov 20, 2012
    Posts:
    220
    I start a webplayer session. The game is running. I do not click anything yet. I use mousecursorzones, by the way. If I move my mouse, the camera moves. That's not convenient, but I haven't spent any time trying to freeze the camera or disallowing player movement in my little test. I now click a button and at the end of that buttons job, I set lockcursor to true. The pointer disappears and the game is ready to go. One click only and all is well. To get back to the buttons, I press escape and proceed as before. Is that, essentially, what you are attempting to do? Sorry if I'm not "getting" it. I ran your little test, and sure enough, it just sits there letting me click the buttons. Maybe just having your button load the level would be easier than activating objects, etc.(but I can see how that delay might not be nice).
    Okay, so I went back into my little test and set the camera freeze state in Start as well as AllowGamePlayInput. Then in my button click, I turn those things on and everything works fine. The camera is locked down and the player doesn't get to do anything until the button is clicked.
     
    Last edited: Dec 16, 2013
  6. mateodon

    mateodon

    Joined:
    Oct 1, 2013
    Posts:
    39
    Has anyone got the AI Add-on to work with the new version of A* Pathfinding Project?
     
  7. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I've accessed AllowGamePlayInput, and it disable movement well enough. But I don't have any luck setting the States outside of Update(). I guess that will keep people from exploring with a menu visible (real-time design visualization). I know this is a small thing, but it's clumsy and detracts from user experience. I don't have this problem in standalone, just started providing webplayer versions. What have I missed? Can you share your code? Thank you for your time looking into this!!

    Code (csharp):
    1.     //-----ufps-----
    2.     private vp_FPController controller = null;
    3.     private vp_FPCamera camera = null;
    4.     private vp_FPInput playerInput = null;
    5.  
    6.     void Awake()
    7.     {
    8.         instance=this;
    9.  
    10.         controller = GameObject.Find("AdvancedPlayer").GetComponent<vp_FPController>();
    11.         camera = GameObject.Find("FPSCamera").GetComponent<vp_FPCamera>();
    12.         playerInput = GameObject .Find ("AdvancedPlayer").GetComponent<vp_FPInput>();
    13.  
    14.         Screen.lockCursor = true;
    15.     }
    16.  
    17.         // no luck
    18.     void Start()
    19.     {              
    20.         playerInput.AllowGameplayInput = true;
    21.         controller.SetState("Freeze", true);
    22.         camera.SetState("Freeze", true);
    23.     }
    24.    
    25.         // freezes everything on rightclick - works fine
    26.     void Update()
    27.     {
    28.         if(Input.GetMouseButtonDown(1))
    29.         {
    30.             Screen.lockCursor = false; 
    31.             window1.enabled = true;
    32.  
    33.             controller.SetState("Freeze", true);
    34.             camera.SetState("Freeze", true);
    35.         }
    36.     }
    37.  
    38.         // regular menu button - works fine
    39.     public void button1_Click(iGUIButton caller)
    40.     {
    41.         controller.SetState("Freeze", false);
    42.         camera.SetState("Freeze", false);
    43.        
    44.         window1.enabled = false;
    45.         Screen.lockCursor = true;  
    46.     }
    47.  
    48.         // start button
    49.     public void button4_Click(iGUIButton caller)
    50.     {
    51.         button4.enabled = false;
    52.  
    53.         playerInput.AllowGameplayInput = true;
    54.         controller.SetState("Freeze", false);
    55.         camera.SetState("Freeze", false);
    56.  
    57.     }
     
  8. BrandSpankingNew

    BrandSpankingNew

    Joined:
    Nov 20, 2012
    Posts:
    220
    It is a pleasure to be of assistance. It makes me dizzy to read other peoples code! ha!! :p

    All that I did was to get a reference to the Player event handler, and also a reference to the UFPS Camera, in Awake, in a small script attached to the player.

    Then, in Start in that same small script that is attached to the Player, I froze the camera and disabled player movement. ... (I initially attempted to do all of that in Awake, and it didn't go very well ... it was kind of "if'y" if you know what I mean ... too indeterminate for me, so I froze things in Start, which works just fine).

    After that, it was all very straight forward. Click a button, set the camera freeze to false, set the allow player movement to true, Voila!

    ////Update is not where you would want to do these things.
    I should have said, I am doing my button in an onGui. You can do it any way that you wish!

    I may not be helping you very well, to be honest. I have the advantage of starting from a clean start, without the clutter of dozens, or hundreds, or thousands of lines of code that you may have you game wrapped up within.

    It is always so much easier, standing here on the outside looking in. ... I would just say, cut through it, drill down, make it easy, this is NOT rocket science.

    You may not be being verbose enough, no insult intended I assure you, but if you have a certain flow in mind then just ... please ... lay that down and I will bet a buck$$ that someone will be happy to step up and give you a hand. (p.s. start a new project or scene and make just this one thing that is boggling you happen ... best of luck!!).

    Declare your vars:
    private vp_FPPlayerEventHandler m_Player;
    private vp_FPCamera m_Camera;

    void Awake(){
    m_Camera = GetComponentInChildren<vp_FPCamera>();
    m_Player = GetComponentInChildren<vp_FPPlayerEventHandler>();

    }

    void Start()
    {
    m_Player.AllowGameplayInput.Set(false);
    m_Camera.SetState("Freeze", true);
    }

    Then, at the end of your button click, do this:
    Screen.lockCursor = true;
    m_Player.AllowGameplayInput.Set(true);
    m_Camera.SetState("Freeze", false);
     
    Last edited: Dec 17, 2013
  9. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    Hi Quixotic7, nice to hear that you are enjoying UFPS!

    Actually our own experience with Oculus Rift is still in its infancy.* The Oculus Rift section in the manual should be seen as very basic setup to get the Oculus up and running. The Rift’s potential is great though, and we will increase our experiments and knowledge base in the near future. Motion controlled hands is definitely something we will look more into.

    For the Jump while running question, is this something you only get when in "Oculus mode"?
     
  10. shawnold

    shawnold

    Joined:
    Dec 25, 2013
    Posts:
    1
    This asset is amazing! Very good job VisionPunk, you're hard work is greatly appreciated in our studio. I have a quick question, just see if I'm going about this the right way. I'm using another asset called MultiOnline, for my player prefab while in game, I basically do a networkView.isMine check, if it is mine, then I leave all the UFPS components on, if its not, I turn them off.

    I've left both the audiosource and audiolistener of course. All seem so to work so far, no double simple gui, movement works and events. After that I moved onto the footstep system, and that's were I ran into a problem. Right after the PlaySound function, I made another function called PlaySoundNet with a [RPC], at the end of the PlaySound function I did yet another networkView.isMine check, if it was mine, I played the normal m_audio locally, and did an RPC call to play the PlaySoundNet function. It does work, but only 1 way, it seems that one of the player prefabs takes over sound, so one client can only hear the others, but one can hear both lol? Confusing :p

    I've also tried doing a networkView.ViewId check, to see if the prefabs networkView.Id matched, still same result. I will be cracking away at this until I get it, but any help or explanation will be awesome! My C# is fairly good, I've gone over both documentations for both assets, just trying to stitch them. I've also tried doing these same methods inside of the vp_fpplayer event handler as well, so only the viewer gets them. But I think doing the component enable/disable does that anyways.

    FYI, I'm using both UFPS and UFPS AI Addon, with MultiOnline.
     
    Last edited: Dec 25, 2013
  11. Upstage

    Upstage

    Joined:
    Nov 16, 2012
    Posts:
    25
    I had a quick question. I've been looking over the notes documentation with some experimenting and I cannot figure out how to prevent the player from sprinting in any other direction then forward. Does anyone know how to fix this?
     
  12. Wrekk

    Wrekk

    Joined:
    Jul 16, 2012
    Posts:
    51
    How do I make retraction work while running/sprinting?
     
  13. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
  14. pinchmass

    pinchmass

    Joined:
    Jul 2, 2012
    Posts:
    156
    Hi I seem to remember you could buy a weapons add-on pack for UFPS, but can't find it on the asset store ?

    can anyone recommend a weapons pack (arms and guns and animations) from the asset store ideally thats compatible with UFPS
     
  15. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    Hi is there a setting or option to invert the mouse axis (Y axis in particular) for the input in UFPS?
     
  16. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    Do you mean that when in sprint mode and close to a wall, the retract might make the camera see through the mesh of the weapon? I got this for the machine gun with the default values. If so I think this is a matter of tweaking the values, for example you could edit or replace the weapon run state for that particular weapon.
     
  17. nJord

    nJord

    Joined:
    Oct 11, 2012
    Posts:
    3
    Hello, I Added this pack to my project and i get this internal compiler error

    "Internal compiler error. See the console log for more information. output was:Assets/UltimateFPSCamera/Scripts/Core/Utility/vp_Utility.cs(171,21): warning CS0618: `UnityEngine.GameObject.SetActiveRecursively(bool)' is obsolete: `gameObject.SetActiveRecursively() is obsolete. Use GameObject.SetActive(), which is now inherited by children.'
    Assets/UltimateFPSCamera/Scripts/Core/Utility/vp_Utility.cs(190,28): warning CS0618: `UnityEngine.GameObject.active' is obsolete: `GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf or GameObject.activeInHierarchy.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPCamera.cs(199,43): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPCamera.cs(535,76): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPCamera.cs(535,35): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPCamera.cs(558,35): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPWeapon.cs(496,103): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPWeapon.cs(496,47): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'
    Assets/UltimateFPSCamera/Scripts/Core/vp_FPWeapon.cs(519,47): warning CS0618: `UnityEngine.Camera.fov' is obsolete: `use Camera.fieldOfView instead.'

    Unhandled Exception: System.UnauthorizedAccessException: Access to the path "C:\Users\daemi_000\Documents\TestGameI1\Temp\Assembly-CSharp.dll.mdb" is denied.

    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0

    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0

    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0

    at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile (Guid guid) [0x00000] in <filename unknown>:0

    at Mono.CSharp.SymbolWriter+SymbolWriterImpl.WriteSymbolFile () [0x00000] in <filename unknown>:0

    at Mono.CSharp.SymbolWriter.WriteSymbolFile () [0x00000] in <filename unknown>:0

    at Mono.CSharp.CodeGen.Save (System.String name, Boolean saveDebugInfo, Mono.CSharp.Report Report) [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0"

    Is there a way to fix this?

    BTW I Run 4.3
     
  18. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I think this error has nothing to do with this asset. Not directly anyway.

    I used to get an error VERY similar to this: Unhandled Exception: System.UnauthorizedAccessException: Access to the path "C:\Users\daemi_000\Documents\TestGameI1\Temp\Assembly-CSharp.dll.mdb" is denied. Would get it with almost every project. Ended up needing to turn off my virus scanner's real time scanning to get it to stop throwing that error.

     
  19. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    XilenceX,

    Yes! In editor , vp_FPCamera, under Mouse, Sensitivity, just add a - in the Y field. :)
     
  20. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    nJord,

    What version of UFPS are you running?
     
  21. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    Hi pinchmass,
    Unfortunately our weapons add-on has been cancelled. See this.

    However any gun model in the asset store should be compatible with UFPS!
    (It's just a matter of tweaking the position, rotation and scale)
    Check out this section in the manual.
     
  22. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Hey Folks,

    Apologies if this has been asked before (I'm sure it has and I can't seem to find it, I've asked over in the VisionPunk forums too )

    We have our player set up to move slower and also run slower than the default setup but we're struggling to find how to control the actual sound effect thats associated with these movements.

    We'd like to have this play slower to sync with our slower walk and run speeds.

    Thought it may have been in the Vp_Footstep Manager but can't see it there and also tried adjusting Step threshold values and Max Input Vel.

    Any help would be much appreciated

    Cheers,
     
  23. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    EDIT: After investigating some more, Looks like these can be edited by adjusting the "BobRate" values in the preset scripts. The BobRate is tied to playing the sound effect.
     
  24. Upstage

    Upstage

    Joined:
    Nov 16, 2012
    Posts:
    25
    Is there a way to prevent sprinting in any other direction besides forward? Also, I've been playing around with the crouch system but I can't find a way to modify it so you don't have to hold 'C' to crouch, so you would just press it once to enable it and press it again to disable. Is there a way to do this?
     
  25. StonePaleAle

    StonePaleAle

    Joined:
    Aug 20, 2012
    Posts:
    28
    override InputCrouch in your own class, or update it in vp_FPInput

    change
    Code (csharp):
    1.  
    2. protected virtual void InputCrouch()
    3. {
    4.     if (vp_Input.GetButton("Crouch"))
    5.         Player.Crouch.TryStart();
    6.     else
    7.         Player.Crouch.TryStop();
    8. }
    9.  
    to
    Code (csharp):
    1.  
    2. private bool _Crouch;
    3.  
    4. protected virtual void InputCrouch()
    5. {
    6.     if (vp_Input.GetButtonDown("Crouch"))
    7.     {
    8.         _Crouch = !_Crouch;
    9.  
    10.         if (_Crouch)
    11.         {
    12.             Player.Crouch.TryStart();
    13.         }
    14.         else
    15.         {
    16.             Player.Crouch.TryStop();
    17.         }
    18.     }
    19. }
    20.  

    If you have Swimming, use this:
    Code (csharp):
    1.  
    2. private bool _Crouch;
    3.  
    4. protected virtual void InputCrouch()
    5. {
    6.     if (Player.Swimming.Active)
    7.     {
    8.         if (_Crouch) _Crouch = false;
    9.         #region hold to swim down
    10.         if (vp_Input.GetButton("Crouch"))
    11.         {
    12.             Player.Crouch.TryStart();
    13.         }
    14.         else
    15.         {
    16.             Player.Crouch.TryStop();
    17.         }
    18.         #endregion
    19.     }
    20.     else
    21.     {
    22.         #region press to crouch - press again to un-crouch
    23.         if (vp_Input.GetButtonDown("Crouch"))
    24.         {
    25.             _Crouch = !_Crouch;
    26.  
    27.             if (_Crouch)
    28.             {
    29.                 Player.Crouch.TryStart();
    30.             }
    31.             else
    32.             {
    33.                 Player.Crouch.TryStop();
    34.             }
    35.         }
    36.         #endregion
    37.     }
    38. }
    39.  
    That should do the trick.
     
  26. Upstage

    Upstage

    Joined:
    Nov 16, 2012
    Posts:
    25
    Thanks! It worked perfectly! Although, I wanted to check if the crouch state is active in another script, but when I put "static" in front of private bool_Crouch; to make it static private bool_Crouch; the crouching doesn't work. I have no idea why it's doing this.
     
    Last edited: Jan 23, 2014
  27. StonePaleAle

    StonePaleAle

    Joined:
    Aug 20, 2012
    Posts:
    28

    Try this in the class.

    Code (csharp):
    1.  
    2. public bool Crouch
    3. {
    4.     get { return _Crouch; }
    5. }
    6.  
     
  28. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Andy, I'm really impressed with both the AI and UFPS assets - great work!

    I was just wondering if there is an easy way to upgrade the free version of Aron Granberg's Astar that comes with AI with the Pro version that I bought?
     
  29. Upstage

    Upstage

    Joined:
    Nov 16, 2012
    Posts:
    25
    It just gives me an error saying "The name `_Crouch' does not exist in the current context". Just to be clear to make sure I didn't misunderstand, I am putting this were private bool _Crouch; was right?
     
  30. StonePaleAle

    StonePaleAle

    Joined:
    Aug 20, 2012
    Posts:
    28
    It should be in the input class with _Crouch, not instead of _Crouch.

    Code (csharp):
    1.  
    2. private bool _Crouch;
    3.  
    4. public bool Crouch
    5. {
    6.     get { return _Crouch; }
    7. }
    8.  
    Check out the VisionPunk Forums here if you haven't already. Lots of questions have been answered there, plus there are some great additions in the Script and Mods section.

    Good luck!
     
  31. Upstage

    Upstage

    Joined:
    Nov 16, 2012
    Posts:
    25
    Yep, I'm constantly checking the Forums! Thanks so much! :)
     
  32. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I am trying to rotate the AdvancedPlayer. I had asked a while ago and I was refereed to a teleport script which acquires the rotation from a transform and applies it to the AdvancedPlayer prefab. It gets the position, but not the rotation.
    I wrote a script where you click and drag and it places the player at the first click location and is supposed to rotate the player facing the MouseUp location. It also only sets the location.

    How do I go about programatically setting the rotation of the player? Thanks.

    Click and drag script:

    Code (csharp):
    1.     private Vector3 mousePosition1;
    2.     private Vector3 screenPosition1;
    3.     private Vector3 mousePosition2;
    4.     private Vector3 screenPosition2;
    5.     private float playerRotation;
    6.     private float playerY;
    7.     private float a = 1;
    8.  
    9.     public Transform player;
    10.  
    11.     void Start ()
    12.     {
    13.         playerY = player.transform.position.y; 
    14.     }  
    15.  
    16.     void Update ()
    17.     {
    18.         if (isActive)
    19.         {
    20.             if (Input.GetMouseButtonDown (0))
    21.             {
    22.                 mousePosition1 = Input.mousePosition;
    23.  
    24.                 screenPosition1 = Camera.main.ScreenToWorldPoint (mousePosition1);
    25.                 screenPosition1.y = playerY;
    26.  
    27.                 player.transform.position = screenPosition1;
    28.             }  
    29.  
    30.             if (Input.GetMouseButtonUp (0))
    31.             {
    32.                 mousePosition2 = Input.mousePosition;
    33.  
    34.                 screenPosition2 = Camera.main.ScreenToWorldPoint (mousePosition2);
    35.                 screenPosition2.y = playerY;
    36.  
    37.                 player.transform.LookAt (screenPosition2);
    38.             }
    39.         }
    40.     }
    teleport script:

    Code (csharp):
    1.    
    2.     public Transform TeleportTarget;
    3.     private GameObject FPS_Player;
    4.  
    5.     void Start()
    6.     {
    7.         FPS_Player = GameObject.Find("AdvancedPlayer");
    8.     }
    9.    
    10.     void OnTriggerEnter(Collider other)
    11.     {      
    12.         if(other == FPS_Player.collider)
    13.         {
    14.             FPS_Player.transform.position = TeleportTarget.position;
    15.             FPS_Player.transform.rotation = TeleportTarget.rotation;
    16.             this.audio.Play();
    17.  
    18.         }
    19.     }
     
  33. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    Hello Eyehawk,
    This is discussed here in our forum, hope you will find it useful: http://visionpunk.vanillaforums.com/discussion/comment/2198/
     
  34. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I noticed today that Unity's Character Controller can not handle a terrain with a lot of tree colliders on it. Even with the Physics layer collision matrix set so that nothing at all collides with the Terrain, the vp_FPController calls to CharacterController.Move in FixedUpdate cause huge CPU usage in Physics.Simulate, dropping my framerate from 40 to 1. I'm guessing Unity does some kind of dumb collision check through all colliders in the scene regardless of Layer Collision or distance. I don't suppose there's anything you can do on UFPS's end to help? I imagine this is yet another reason that people are abandoning character controllers to just use RigidBody controllers... Unity themselves seem to have given up on using CharacterController in their more recent sample projects. Do you think UFPS might make the switch at some point?
     
  35. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Many thanks Andy!

    I used Erynes method:
    - Installed AI
    - Deleted A*Pathfinding folder
    - Deleted A*Pathfinding PRO folder
    - Installed A*Pathfinding PRO again
    (- some minor errors that i fixed)
    - Changed Mathfx to AstarMath
    - needed to add: using Pathfinding; in vp_AIAStartEditor.cs

     
  36. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141

    I got the same problem here, would appreciate it if someone would solve this, or at least give some explanation about this rotation thing when teleporting.
     
  37. StonePaleAle

    StonePaleAle

    Joined:
    Aug 20, 2012
    Posts:
    28

    Try this:
    Don't use the Player. Use the Controller and the Camera.

    StartPosition below is a placeholder GameObject (a public variable in the script).

    Code (csharp):
    1.  
    2. // Calling code
    3. TeleportPlayer(StartPosition.transform.position, StartPosition.transform.eulerAngles);
    4.  

    Code (csharp):
    1.  
    2. // Method to move
    3. public void TeleportPlayer(Vector3 position, Vector2 eulerAngles)
    4. {
    5.     //vp_FPController
    6.     _FPController.SetPosition(position);
    7.     // vp_FPCamera
    8.     _FPCamera.SetRotation(eulerAngles);
    9. }
    10.  
    Hope that helps.
     
  38. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    @StonePaleAle Thanks for helping, it worked :)
     
  39. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Has anyone managed to get UFPS working with a rigidbody instead of CharacterController? Visionpunk has done so much work in the vp_FPController script to customize the CharacterController and make it act more like a RigidBody that it seems like it shouldn't be too much of an ordeal to swap it out. The capsule-based things like crouching and grounding all work fine when swapping a capsule collider for the character controller, it's mostly just the movement that I'm having trouble with.
     
  40. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Any updates from UFPS, not seen Cal on the official forums for long time...everything ok?
     
  41. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    How can I remove the collider from the player? I'm trying to make a No-Clip/Fly mode. I can remove the colliders from all of the geometry in the scene and it has the same effect, but hangs a moment while processing. Thanks.
     
  42. BrandSpankingNew

    BrandSpankingNew

    Joined:
    Nov 20, 2012
    Posts:
    220
    Transform.position = something... would let you move your guy through walls, etc., but because it (the CharacterController) uses .Move, it isn't going to work. Move kind of checks for collisions, I think.

    Maybe, instead of disabling all of the colliders (which really shouldn't "seem" too time intensive if you wrapped it up in some kind of screen fade down/fade up effect when you enter/exit GodMode) you might be able to work on a raycast and just disable the collider that you are facing at a given moment.

    Having said that, during my research upon your problem I did come across a couple of scripts. Here is a GitHub link that may lead you to a solution. https://github.com/mikelovesrobots/unity3d-no-clip-first-person-controller
     
  43. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    good, so I didn't miss anything with the UFPS. Some good ideas, either the fade or raycast are my best bets now. The raycast would be limiting if the user tried to strafe. Wait, unless I used 3, or even 4, all sides! I'll post back. Thanks.
     
  44. BrandSpankingNew

    BrandSpankingNew

    Joined:
    Nov 20, 2012
    Posts:
    220
    A CheckSphere might handle this for you nicely. OverlapSphere might also do the trick. Looking at the damage handlers (vp_DamageHandler and vp_PlayerDamageHandler) might be good. Also taking a gander at vp_Explosion and vp_SimpleAITurret might be good. These things are used in the AI files also, in the combat and senses parts.
     
  45. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
  46. Andy_

    Andy_

    Joined:
    Dec 12, 2013
    Posts:
    80
    Hello makeshiftwings,
    We havn't heard of such issues before.
    Right now there is no plan to swap character controllers for rigid body controller.
    Still it may happen in a future update.
    Thanks for reporting this.
    Andy
     
  47. daisySa

    daisySa

    Joined:
    Dec 29, 2011
    Posts:
    341
    Andy - same issue here. I've only noticed it in the past few days, so it may be related to a recent Unity update. The framerate suddenly dropped significantly, and the Profiler showed Physics.Simulate grabbing a huge chunk of the CPU (about 50%).

    makeshiftwings - I added a rigidbody to my character, disabled "use gravity" and froze rotation. Even though UFPS is using the character controller (and therefore I can't remove it), it did resolve the issue. I've been running this way for a couple of days now with no problems.

    Edit: Just did a quick test: 55fps with rigidbody, 30fps without it.
     
    Last edited: Feb 4, 2014
  48. cjow

    cjow

    Joined:
    Feb 29, 2012
    Posts:
    132
    Got a weird bug at the min where weapon camera isn't drawing anything until you first switch to the scene view and then switch back. I've merely dragged the AdvancedPlayer prefab in, removed all but one of the weapons and then renamed it and made it use one of our models instead. Once I've switch to scene view and back it's working fine but it's causing it not to be rendered in builds as well.

    Anyone come across this before? I'm stumped as to what could be causing it.

    Thanks.
     
  49. neroziros

    neroziros

    Joined:
    Aug 25, 2012
    Posts:
    129
    Hi there, how could I add acceleration at the start of the movement (like damping but at the beginning of the movement, to get a smooth movement startup)
     
  50. Deleted

    Deleted

    Joined:
    Dec 8, 2012
    Posts:
    16
    • Is it possible to assign each weapon a different fire power (eg. a crate is destroyed using less shots with a weapon instead of another)?
    • Is it possible to let some weapons zoom more than others?
     
Thread Status:
Not open for further replies.