Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Infinite Runner Starter Pack

Discussion in 'Assets and Asset Store' started by opsive, May 23, 2013.

  1. frak

    frak

    Joined:
    Feb 8, 2013
    Posts:
    45
    That was the portion of code that I thought I should be looking at. Yes the sizes in that array are off when overlaps occur.

    Most commonly it is size 0. Note that most of the time these platforms have the size they should have - it is not specific platforms that do this all the time (I did not notice for a while that it was going on, actually, until I realised that some of the tiles had more detail elements than I had built!

    Things can get more intersting when a direction change takes place.

    I put in some debug prints and the size comes up as 0 on that array.
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    At least it doesn't look like it is a problem with the Infinite Object Generator- that would have been more work to debug.

    Take a look at line 114 within the Infinite Object Manager:

    Code (csharp):
    1.  
    2.                 platformSizes[i] = platform.GetComponent<Renderer>().bounds.size;
    3.  
    This value should be consistent between runs and it doesn't sound like it is. Do you have multiple renderers setup on one object? It could be getting a different renderer each time. Alternatively, you can manually specify the size with the overrideSize property and that's guaranteed to be consistent.
     
  3. rollingrebels

    rollingrebels

    Joined:
    Dec 13, 2013
    Posts:
    6
    Hello All,

    I have just 4 months experience in Unity3D. I have demo project just like infinite run. But I have faced some problems. Can anybody tell me How I apply tilt effect just like Infinite run? I don't have enough to buy this game. If any one help I will be very grateful to him/her.
     
  4. rollingrebels

    rollingrebels

    Joined:
    Dec 13, 2013
    Posts:
    6
    Hello All,

    I have just 4 months experience in Unity3D. I have demo project just like infinite run. But I have faced some problems. Can anybody tell me How I apply tilt effect just like Infinite run? I don't have enough to buy this game. If any one help I will be very grateful to him/her.
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Hi rollingrebels,

    Your question will probably get more replies if you create a new topic within the scripting section of the forum. In any case take a look at Input.acceleration for measuring the tilt value. From there you can use that value to add movement to your character.
     
  6. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi Opsive, How can i make the character shifting lanes like subway surfer. (jumping between)
     
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    You'll need to play an animation when the player changes slot within PlayerController:changeSlots. This is actually a new feature that we are putting in version 1.5, and we hope to submit within a week.
     
  8. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Oh thats cool. Will try that.
     
  9. Enuniq

    Enuniq

    Joined:
    Oct 17, 2013
    Posts:
    10
    Ok I have a little question:

    I'm creating a fish game with this kit. The problem is, I don't need to use the platforms really (or I don't think I do). Obviously, fish don't follow "paths". Also, fish go above the surface. Any help? Thanks!
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Hi Enuniq,

    If you don't need to use platforms and just want to use scenes that's no problem. The one trick is to treat your scenes as platforms - assign them a platform object and place them in the platforms section within the infinite object manager. The pack runs fine without scenes, though it does need platforms in order to work.. what you define as a platform is up to you :)

    If you want your fish to be able to float above the surface then disable the gravity property on your fishes rigidbody. You'll then be able to move it in any vertical position.
     
  11. Sinhabros

    Sinhabros

    Joined:
    Aug 3, 2013
    Posts:
    15
    Is there a way to make the camera lag when the player changes slots to make it look smoother?
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    The camera controller has a setting that allows it to stay at the same height even when the character is jumping (called Steady Height). I would take a look at how that feature works and modify it after that. Steady height works with the vertical position and you want one to work with the horizontal position. The difference is that steady height keeps things still whereas you just want to slow down the horizontal translation. It is going to take a little bit of work to get it looking good but it should definitely be possible. I am submitting version 1.5 within the next day or two but I can add this as a feature to version 1.6.
     
  13. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    hi opsive ,

    do u have any plan to implement raycast shooting weapon , punch / kick attack ?

    i want to implement any of this , can u help me please ?
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Hi jathoo,

    If you change the attack type to "fixed" it will fire a raycast between the distances close attack distance and far attack distance. To have a shooting or a punch/kick attack all you need to do is change the attack animation to that type. The code should all be in there.
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I've had a couple of people ask me what is in the next version so I thought that I would just go ahead and post the release notes (along with pictures for the more-visual items). We are submitting this update today. The webplayer has already been updated with most of these features (http://www.opsive.com/assets/InfiniteRunnerStarterPack/). Also, the promotional 35% off price is going to go back to its normal price whenever Unity approves the update (probably within the next week).

    -A chase object
    $dragon.PNG

    -Mecanim support
    $mecanim.PNG

    -The camera no longer has to be positioned behind the player - making side view runners possible
    $camera position.PNG

    -New power up particles and a new speed boost power up
    $speed.PNG

    -Obstacles can now be marked as being able to be run on top of
    $table.PNG

    Continue in next post (can only upload five pictures in a single post)
     
    Last edited: Feb 4, 2014
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    -New power up progress GUI icon
    $power up icon.PNG

    -A strafe animation when changing slots
    $strafe.PNG

    -Removed starter pack deprecation warnings
    -Bugfixes
     
    Last edited: Feb 4, 2014
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Unity just approved version 1.5!

    - Added a chase object
    - Mecanim support - extract CharacterMecanim.unitypackage to use mecanim
    - The camera no longer has to be positioned behind the player - making side view runners possible
    - New power up particles and a new speed boost power up
    - Obstacles can now be marked as being able to be run on top of
    - New power up progress GUI icon
    - A strafe animation when changing slots
    - Removed deprecation warnings
    - Minor bug fixes
     
  18. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
  19. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,457
    @Opsive,

    Super cool, thanks for the update.
    Some very nice new features. Would be awesome to have a video and examples that shows off the new features.

    Cheers.
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Definitely, I still need to make one for curves as well. We are submitting a new asset next week so I'll record some more videos for the starter pack when I am recording videos for that new asset.
     
  21. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
    When you get time, there is a little bug when you start a game then hit the pause button then go back to the main menu. the runner keeps running while in the main menu.
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Good catch. I had to change the way game over was called on the player controller because of mecanim. To fix this issue add the following to line 199 of GameManager.cs:

    Code (csharp):
    1.  
    2. ...
    3.             dataManager.gameOver();
    4.             if (playerController.enabled) // <--
    5.                 playerController.gameOver(gameOverType); // <---
    6.             if (chaseController != null)
    7. ...
    8.  
     
  23. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
  24. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
    I was just wondering, if I wanted to make a side scroller what would i need to do other then move the camera to the side? I didn't look much at it yet but I would assume you can set it to 1 lane. Also the obstacles would have to spawn in 1 lane.
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    That's all that you need to do :) On the camera controller just set the in game position/rotation to somewhere on the side and it'll work. For the obstacles you can reduce it to one lane by specifying on the platform object that platforms can only spawn in the center lane. Alternatively on collidable object you could also set it to only spawn in the center lane. Either method will work.
     
  26. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
    Thanks again.
     
  27. mujee

    mujee

    Joined:
    Mar 9, 2012
    Posts:
    54
    the new version 1.5 is Amazing and very nice.

    when ever I slide when player is on stairs .then player goes inside the stair. please guide me what can I do
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I'm happy to hear that you're enjoying 1.5. The player is going inside the stairs because of the slide animation, correct? The best solution that I can think of there is to play a different animation when the player is on the stairs. Change PlayerAnimation:slide to:

    Code (csharp):
    1.  
    2.     public void slide(PlatformSlope slope){
    3.         string animationName = "";
    4.         if (slope == PlatformSlope.None) {
    5.            animationName = runSlideAnimationName;
    6.         } else if (slope == PlatformSlope.Up) {
    7.            animationName = slopeUpSlideAnimationName;
    8.         } else {
    9.            animationName = slopeDownSlideAnimationName;
    10.         }
    11. #if !UNITY_3_5
    12.         if (useMecanim) {
    13.             StartCoroutine(playOnce(animationName));
    14.         } else {
    15. #endif
    16.             thisAnimation.CrossFade(animationName);
    17. #if !UNITY_3_5
    18.         }
    19. #endif
    20.     }
    21.  
    For this code to work you'll need an animation named slopeUpSlideAnimationName and slopeDownSlideAnimationName. That method gets called within PlayerController:slide, and you can change that call to:
    Code (csharp):
    1.  
    2. playerAnimation.slide(platformObject != null ? platformObject.slope : PlatformSlope.None);
    3.  
    This will only work when the player starts sliding and is on the stairs. If the player is already sliding and goes on the stairs you'll need to do a check within the Update loop of the PlayerController and adjust the animation if the platform slope changes.

    If you don't want to deal with all of the different animations, one other way you might tackle it is to just adjust the rotation of the player if he is sliding and is on a slope. This way you could use the same animation for no slope, slope down, and slope up. The disadvantage is that it would probably look weird if you are sliding up a slope (I guess I don't know of a good animation in that case.. the physics don't normally work well with somebody sliding up a set of stairs).
     
    Last edited: Feb 18, 2014
  29. mujee

    mujee

    Joined:
    Mar 9, 2012
    Posts:
    54
    tanx for reply. i will do as you Stated above.
    one other thing.
    when I Select boost. I turn player at corner.player run at backward direction. this condition happen some time.
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I see what you mean, I also was able to reproduce it somewhat often. I am currently going through and cleaning up some of the player/camera movement, I'll track down this bug as well. As soon as I get all of this fixed I will submit this as a 1.5.1 update and I can send it to you after I submit.
     
  31. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi Opsive,

    How can we make the character walk and gradually running when starting the game?

    thanks
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Are you talking about actual move speed or animations? For actual move speed you just have to adjust the forward speeds within the PlayerController. If you want to play a walk animation then within PlayerAnimation:setRunSpeed you can either play a walk or run animation based off of the speed of the character. You'll need to add a new walk animation and do something like:

    Code (csharp):
    1.  
    2. #if !UNITY_3_5
    3.         if (useMecanim) {
    4.             thisAnimator.SetFloat("Speed", speed);
    5.         } else {
    6. #endif
    7.             if (speed < YOUR_WALK_CUTOFF  !thisAnimation.isPlaying(walkAnimationName)) {
    8.                 thisAnimation.CrossFade(walkAnimationName);
    9.             } else if (speed > YOU_WALK_CUTOFF   !thisAnimation.isPlaying(runAnimationName)) {
    10.                 thisAnimation.CrossFade(walkAnimationName);
    11.             } else if (speed > YOU_WALK_CUTOFF) { // still allow various run animation speeds
    12.                 thisAnimation[runAnimationName].speed = Mathf.Lerp(slowRunSpeed, fastRunSpeed, t);
    13.             }
    14. #if !UNITY_3_5
    15.         }
    16. #endif
    17.  
    If you are using mecanim you'd just create a walk state and have it trigger based off of the speed.
     
  33. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    hi ,

    is there any way to place a single (scene) object , without attaching it to a main scene object . something like random trees in a forest or random road signs in a main road , without needing the 2 side walls and a floor ? and when i place a terrain / plane , the far objects are floating on air . any way to handle it or should i cover both side with objects to cover it ?

    thanks
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    If you only want to use the Infinite Object Manager then there isn't a way. However, in your case what I would do is subclass SceneObject and have it randomly create your random object when it is initialized. Something like:

    Code (csharp):
    1.  
    2. public class RandomSceneObject : SceneObject
    3. {
    4.     public GameObject[] randomObjects;
    5.  
    6.     public override void Awake()
    7.     {
    8.         base.Awake();
    9.  
    10.         // spawn a random object
    11.         if (randomObjects != null  randomObjects.Length > 0) {
    12.             GameObject spawnedRandomObject = GameObject.Instantiate(randomObjects[UnityEngine.Random.Range(0, randomObjects.Length)]) as GameObject;
    13.             spawnedRandomObject.transform.parent = thisTransform;
    14.         }
    15.     }
    16. }
    17.  
    This probably would be the easiest and most straight forward way. That way you won't have to create a thousand different scene objects just to have a variety of trees/signs.
     
    Last edited: Feb 21, 2014
  35. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    i made the subclass script file and and added it to the random object . and couldn't get it work

    tried to put it under InfiniteObjectManager array as well , cud u plz give me the steps ? thanks
     
    Last edited: Feb 21, 2014
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I reworked some of the code above so make sure you grab that version.

    Don't add the RandomSceneObject component to your random object, rather, replace it with the SceneObject component on your scene object. I imagine that this will be the ground and the walls of your forest. Then add that scene object to the Infinite Object Manager under the scenes. You then place whatever trees you want to spawn within the randomObjects array. Your random objects don't need any special components added to them. Does that help at all?
     
  37. jathoo

    jathoo

    Joined:
    Feb 11, 2013
    Posts:
    29
    hi,

    its only generating the 1st randomobject of the array and its not deactivating it , and randomobject is just there visible all the way , did i miss something ?
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    That's what I get for trying to write code while in a browser. :) Look back at my original post and use that code - it will work.
     
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    I just uploaded a new web demo. I reworked the core implementation of PlayerController and CameraController and as a result everything is a lot smoother. Throughout this process I also fixed the bug that mujee mentioned with the turn and the power ups. Even though I was planning on improving the camera in version 1.6 I'll just stick it in 1.5.1 since it is a big improvement. I plan on submitting this update within the next week or so.
     
  40. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    there is a bug when at the turning platform, sometimes when i turn, the player turn the other side instead.
    the smoother control update is not in the asset store yet ?
     
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Thanks for letting me know - I am almost certain that this has been fixed in the update that makes things smoother but I'll double check.

    I have not submitted this update to the store yet. I need to do a little bit more cleanup and I want to write a tool to make migration easier. The major change that this update brings is that the character is now using a CharacterController instead of a rigidbody/capsule collider. The CharacterController allows for finer control over things. I can send you update as soon as I submit it to the asset store though so you don't have to wait on Unity to approve it.
     
  42. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    i just purchased it a few days ago and still trying to understand the design of the codes.. i want to replace the character with a cube with no animation, is that hard to modify the codes ?
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    Take a look at this video for using your own assets: http://www.youtube.com/watch?v=cnG98rNpfek. The version that I used to record it but most of the concepts are the same.

    As far as a cube with no animation, the PlayerController assumes there is going to be some animation but to not have any animation all you have to do is remove the references to the 'thisAnimation' component.
     
  44. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi Opsive,

    The smooth camera movement looks great, Is it updated in the asset store? Can you send me a PM if not?

    Thanks
    Dharma
     
  45. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    how do i change the startup scene ?
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
  47. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    there is a bug where if i removed all the probability rules for some objects and save and exit unity, when i open again it get back all the default probability rules again. what is happening ?
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    If you are making changes to the instance of a prefab make sure you apply those changes before you close Unity. Also, make sure the project is saved otherwise Unity won't keep the changes that you made within the project.
     
  49. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    i think its related to unity crashing when closing. it happens sometimes
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,093
    That will also do it. If Unity is crashing report the bug using Unity's bug reporter tool.