Unity Community


Page 3 of 11 FirstFirst 12345 ... LastLast
Results 41 to 60 of 211

  1. Location
    USA
    Posts
    122
    I am taking your tutorial and trying to make it run on android. I used your script but when I run it on my phone it only makes one bullet appear I need it to be more like a machine gun. Can you please help me?

    hear is my code


    Code:  
    1. var shootButton : GUITexture;
    2. var fireSpeed : float;
    3. var waitTillNextFire : float;
    4. var bullet : GameObject;
    5. var bulletSpawn : GameObject;
    6.  
    7.  
    8.  
    9. function Update()
    10.  
    11. {
    12.  
    13.     var count : int = Input.touchCount;
    14.  
    15.    
    16.  
    17.     for(var i: int = 0;i < count; ++i)//for multi touch
    18.  
    19.     {
    20.  
    21.         var touch : Touch = Input.GetTouch(i);
    22.  
    23.    
    24.  
    25.         if(shootButton.HitTest(touch.position) && touch.phase == TouchPhase.Began)
    26.  
    27.         {
    28.             //Do somthing
    29.             if(waitTillNextFire <= 0)
    30.             {
    31.             if(bullet)
    32.             Instantiate(bullet,bulletSpawn.transform.position, bulletSpawn.transform.rotation);
    33.             waitTillNextFire = 0.1;
    34.            
    35.             }
    36.        
    37.         }
    38.         waitTillNextFire -= Time.deltaTime * fireSpeed;
    39.  
    40.     }
    41.  
    42. }


  2. Location
    Pfafftown NC
    Posts
    3
    I barely can walk around and when I stop pressing WSAD I continue to move and my camera still jerks around HELP!!!! I've used the scripts as written by you in a different thread and they still wont work correctly
    Greatness from small beginnings- Sir Frances Drake UC3


  3. Location
    Michigan USA
    Posts
    460
    Quote Originally Posted by cj13810 View Post
    I am taking your tutorial and trying to make it run on android. I used your script but when I run it on my phone it only makes one bullet appear I need it to be more like a machine gun. Can you please help me?

    hear is my code


    Code:  
    1. var shootButton : GUITexture;
    2. var fireSpeed : float;
    3. var waitTillNextFire : float;
    4. var bullet : GameObject;
    5. var bulletSpawn : GameObject;
    6.  
    7.  
    8.  
    9. function Update()
    10.  
    11. {
    12.  
    13.     var count : int = Input.touchCount;
    14.  
    15.    
    16.  
    17.     for(var i: int = 0;i < count; ++i)//for multi touch
    18.  
    19.     {
    20.  
    21.         var touch : Touch = Input.GetTouch(i);
    22.  
    23.    
    24.  
    25.         if(shootButton.HitTest(touch.position) && touch.phase == TouchPhase.Began)
    26.  
    27.         {
    28.             //Do somthing
    29.             if(waitTillNextFire <= 0)
    30.             {
    31.             if(bullet)
    32.             Instantiate(bullet,bulletSpawn.transform.position, bulletSpawn.transform.rotation);
    33.             waitTillNextFire = 0.1;
    34.            
    35.             }
    36.        
    37.         }
    38.         waitTillNextFire -= Time.deltaTime * fireSpeed;
    39.  
    40.     }
    41.  
    42. }
    the problem is the touch phase. basically right now, it's like it's set to "GetButtonDown" and you need "GetButton" only in touch form. try this:

    Code:  
    1. if(shootButton.HitTest(touch.position))
    2. if ( touch.phase == TouchPhase.Stationary || touch.phase == TouchPhase.Moved)
    3. {
    4.           //Do somthing
    5.  
    6.             if(waitTillNextFire <= 0)
    7.  
    8.             {
    9.  
    10.             if(bullet)
    11.  
    12.             Instantiate(bullet,bulletSpawn.transform.position, bulletSpawn.transform.rotation);
    13.  
    14.             waitTillNextFire = 0.1;
    15.  
    16.            
    17.  
    18.             }
    19. }
    My Youtube Channel - youtube.com/ETeeskiTutorials
    My Website - ETeeskiTutorials.com
    Texture Pack - 100 tiled textures for level design, all 2048x2048 - Asset Store - WebPlayer Demo


  4. Location
    Michigan USA
    Posts
    460
    Quote Originally Posted by Minuits2012 View Post
    I barely can walk around and when I stop pressing WSAD I continue to move and my camera still jerks around HELP!!!! I've used the scripts as written by you in a different thread and they still wont work correctly
    it sounds like you need to play around with the variables in the inspector:
    (PlayerMovementScript)
    walkAcceleration
    walkDeacceleration
    maxWalkSpeed
    (MouseLookScript)
    headbobSpeed
    headbobAmountX
    headbobAmountY
    My Youtube Channel - youtube.com/ETeeskiTutorials
    My Website - ETeeskiTutorials.com
    Texture Pack - 100 tiled textures for level design, all 2048x2048 - Asset Store - WebPlayer Demo


  5. Location
    USA
    Posts
    122
    It is still not working. Now instead of spawning one bullet its not spawning any.


  6. Location
    Argentina
    Posts
    22
    Hello,

    I'm on episode 1.19 Headbob Movement

    The problem is: when I follow the step of fixing the code to avoid the gun glitch, when I change "function Update()" to "function LastUpdate()" in the gunscript, the gun just float on the air without moving or following the player at all.

    My thread: here

    thanks!
    Last edited by Cinematronic; 06-18-2012 at 05:54 PM.
    Check out El Eternauta Game development!
    http://www.indiedb.com/games/eleternauta


  7. Location
    USA
    Posts
    122
    thank you for your help I was able to get it to work.


  8. Posts
    3
    I have watched 1.7 but I'm still slippery, here is my code:

    var walkAcceleration : float = 5;
    var walkAccelAirRatio : float = 0.1;
    var walkDeacceleration : float = 5;
    @HideInInspector
    var walkDeaccelerationVolx : float;
    @HideInInspector
    var walkDeaccelerationVolz : float;
    var cameraObject : GameObject;
    var maxWalkSpeed : float = 20;
    @HideInInspector
    var horizontalMovement : Vector2;
    var jumpVelocity : float = 20;
    @HideInInspector
    var grounded : boolean = false;
    var maxSlope : float = 60;

    function Start () {

    }

    function Update ()
    {
    horizontalMovement = Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
    if (horizontalMovement.magnitude > maxWalkSpeed)
    {
    horizontalMovement = horizontalMovement.normalized;
    horizontalMovement *= maxWalkSpeed;
    }

    rigidbody.velocity.x = horizontalMovement.x;
    rigidbody.velocity.z = horizontalMovement.y;

    if (grounded)
    {
    rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x, 0, walkDeaccelerationVolx, walkDeacceleration);
    rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z, 0, walkDeaccelerationVolz, walkDeacceleration);
    }

    transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).current YRotation, 0);

    if (grounded)
    rigidbody.AddRelativeForce(Input.GetAxis("Horizont al") * walkAcceleration * Time.deltaTime, 0, Input.GetAxis("Vertical") * walkAcceleration * Time.deltaTime);
    else
    rigidbody.AddRelativeForce(Input.GetAxis("Horizont al") * walkAcceleration * walkAccelAirRatio * Time.deltaTime, 0, Input.GetAxis("Vertical") * walkAcceleration * walkAccelAirRatio * Time.deltaTime);

    if (Input.GetButtonDown("Jump") && grounded)
    rigidbody.AddForce(0,jumpVelocity,0);
    }

    function OnCollisionStay (collision : Collision)
    {
    for (var contact : ContactPoint in collision.contacts)
    {
    if (Vector3.Angle(contact.normal, Vector3.up) < maxSlope)
    grounded = true;
    }

    }

    function OnCollisionExit ()
    {
    grounded = false;
    }

    Please help!


  9. Posts
    8
    Your tutorials are awsome!I watch your videos FPS.8-FPS.11 and everything ok:gun zoom and etc,but when i am looking down to floor my character jump.i have not bugs in scripts.please help


  10. Posts
    8
    Your tutorials are awsome!I watch your videos FPS.8-FPS.11 and everything ok:gun zoom and etc,but when i am looking down to floor my character jump.i have not bugs in scripts.please help http://forum.unity3d.com/threads/141...trange-problem


  11. Posts
    7
    Last edited by Zxero; 06-26-2012 at 03:41 PM. Reason: SOLVED but i have another problem now


  12. Posts
    7
    ok problem again .... FPS1.7 1.8 and 1.9 :P ....all infos in the link (sorry for bad eng i'm from romania)

    please Eteeski ... i rlly need help xD

    http://forum.unity3d.com/threads/141...e-look-problem
    Last edited by Zxero; 06-27-2012 at 07:36 AM.


  13. Posts
    1
    Need A Bit Debugging

    var walkAcc:float = 25.0;
    var cameraObject:GameObject;
    var maxWalkSpeed:float=20.0;
    var jumpVelocity:float=2000.0;
    @ HideInInspector
    var grounded:boolean=false;
    var maxSlope:float=60.0;
    @ HideInInspector
    var horizontalMovement:Vector2;
    function Update ()
    {

    horizontalMovement = Vector2(rigidbody.velocity.x,rigidbody.velocity.z) ;
    //Limit Speed
    if(horizontalMovement.magnitude > maxWalkSpeed)
    {
    horizontalMovement.Normalize();
    horizontalMovement *= maxWalkSpeed;
    }

    rigidbody.velocity.x=horizontalMovement.x;
    rigidbody.velocity.z=horizontalMovement.y;
    //Start Running
    transform.rotation=Quaternion.Euler(0,cameraObject .GetComponent(MouseLookScript).currentYRotation,0) ;
    rigidbody.AddRelativeForce(Input.GetAxis("Horizont al")*walkAcc,0,Input.GetAxis("Vertical")*walkAcc );
    //jump on Pressing space and if on grounded
    if (Input.GetButtonDown("Jump") &&grounded)
    rigidbody.AddForce(0,jumpVelocity,0);
    }
    function OnCollisionEnter (collisionInfo : Collision)
    {
    for (var contact : ContactPoint in collisionInfo.Contacts)
    {
    if (Vector3.Angle(contact.normal, Vector3.up) < maxSlope)
    grounded = true;
    }
    }
    function OnCollisionExit ()
    {
    grounded = false;
    }


  14. Posts
    2

    smoothness

    Hi, first i want to say that your tutorial is great!

    I'm on 1.8 and I noticed that when the player circulates a object (circling it with wasd and always looking for him) the object shakes a lot, it takes a lot of smoothness. I already downloaded the final project file of your tutorial and the same thing happens. You noticed that too? Any idea how to solve this?

    thank you


  15. Location
    Michigan USA
    Posts
    460
    Quote Originally Posted by AlexSR View Post
    Hi, first i want to say that your tutorial is great!

    I'm on 1.8 and I noticed that when the player circulates a object (circling it with wasd and always looking for him) the object shakes a lot, it takes a lot of smoothness. I already downloaded the final project file of your tutorial and the same thing happens. You noticed that too? Any idea how to solve this?

    thank you
    Is it the floor that's shaking? I did notice that. It's because I scaled the floor up to like 1000000x1000000 if you scale it down to something reasonable, the shaking stops.
    My Youtube Channel - youtube.com/ETeeskiTutorials
    My Website - ETeeskiTutorials.com
    Texture Pack - 100 tiled textures for level design, all 2048x2048 - Asset Store - WebPlayer Demo


  16. Posts
    2
    Is not the floor.

    In the video will not show up, but if you do the same movement you will see.
    Last edited by AlexSR; 07-01-2012 at 08:41 PM.


  17. Posts
    9
    Hi eteeski,

    Great tutorials, really loving your unique style and teaching methods. I especially loved the one breaking down quaternions into layman's terms, although sadly I'm still getting my head around them! I'm sure the penny will drop sooner or later!

    Now to my question. I am in the process of modifying the mouse-look script to behave in the following way:

    While the mouse button is down enable mouse look (so the player can't change view unless the button is down). Now this bit is pretty simple, even for me. I just wrapped the following line inside an if statement. Well, it seems to work as expected anyway .

    if (Input.GetButton("Fire1")){
    transform.rotation = Quaternion.Euler(currentXRotation, currentYRotation, 0);
    }

    Ok, now the tricky bit I just can't get my head around... How can I make it so that once the user lets go of the mouse button the camera will gradually ease to a stop based on how quickly the user was turning when letting the button go? Just to clarify, all I need the camera to do is rotate on the spot. There are no translations involved as the camera is locked to position 0,0,0.

    From my research into the available quaternion functions in the unity docs and from my uneducated point of view it seems that all of them expect you to be able to give the function a position that you eventually want the rotation to end at or point towards. I don't know the exact point that I'd like the camera to come to a rest as it is based on mouse velocity in X and Y which can change dynamically. I really hope I am over-complicating this issue (as oddly I tend to do with unity). Most problems I encounter end up being so much more straightforward than I could have imagined when planning how to execute them in the first place!

    Thanks so much for your time and keep up the incredible work. You are an inspiration to me.

    Rowley
    Last edited by RowleyBirkin; 07-04-2012 at 12:52 PM. Reason: clarify that the cam is static


  18. Posts
    2

    FPS 1.15 Bullet Spread

    I would like to apply camera shake using Random.value every time a bullet is fired. Like you did with the gun but just to the camera instead. I am at a loss on how to approach doing this.

    Here is my thread.

    http://forum.unity3d.com/threads/142...908#post976908

    Also thanks for your tutorials they have been excellent! I wish I would have come across them sooner.


  19. Posts
    1
    @GiORg1 how did you fix the the problem of when looking down and your character jumps/moves about like the gun is effecting the player ?

    Also another problem I have is in FPS1.23 Switching Guns the switch weapon command only works once?

    Thanks for any help guys/girls
    Last edited by GothicGhost; 07-08-2012 at 12:05 PM.


  20. Posts
    1
    Hi I set the player the to 12.5,3.5,0 . AND the gun to 13,3,1 . If i press play the gun transformes its position to 12.5,4.5,0 . What did i wrong? Sry fór my horrible english.

Page 3 of 11 FirstFirst 12345 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •