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

[Released] 2D Platform Controller

Discussion in 'Assets and Asset Store' started by JohnnyA, Mar 11, 2013.

  1. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    There is no allocation for turning on and off a collider.

    $Screen Shot 2013-08-14 at 9.18.59 PM.png

    However if you used a naive approach to ignore collisions for a collection of colliders (for example the player or enemy colliders) you would be allocating. For example

    Code (csharp):
    1.  
    2. foreach (Collider other in otherColliders) {
    3.   Physics.IgnoreCollision(boxCollider, other, true);       
    4. }
    5.  
    allocates 24 bytes per caller.

    You can write it so it doesn't allocate, for example this like:

    Code (csharp):
    1.  
    2. var enumerator = otherColliders.GetEnumerator();
    3. while (enumerator.MoveNext()) {
    4.   var other = enumerator.Current;
    5.   Physics.IgnoreCollision(boxCollider, other, true);       
    6. }
    7.  
    but thats my problem with this kind of advice. The people who know stuff like this probably don't need the advice. For the rest they have made some function that was unlikely to be a problem faster, but in the meantime made their code more complicated and potentially introduced a different harder to fix set of problems.
     
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    The only thing I would be aware of with your posted solution is that the base direction checker does a SwitchDirection() call. This is only needed if your character is not symmetrical.
     
  3. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    318
    When I was talking about allocations I was talking more about how things are handled internally more than the byte allocation "per se". When an object goes active/deactive, the physic world needs to be updated to remove the object from the list and then re-calculate all the physics based on the actual number of rigidbodies which is not recommended by any engine, it's an operation that takes usually more time than just skip the collision.

    But just as you said, experienced people don't need advice for a thing like this :)
     
  4. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Hi i try use EnemyAIController and he change always direction and never go to the target but path is simple
     
  5. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Did you provide a map of the level geometry to the character?
     
  6. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    for sure i do
     
  7. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    It's a little bit hard to help without more information. How does you level differ from the sample, what do you want it do, what does it do, etc.

    In the end the extra features packages are included as is, they may not meet your needs, but I will certainly try and help if you provide more details. You can also email me at the support email address if you want to include a package.

    - John A
     
  8. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    $43s7z.png

    oh it's very basic i look for red go to blue and here after 2 try she jump in void ! :) it's funny to see
     
  9. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,291
    Didn´t you include a pus and pull feature?
    I swear i saw it but can not find it anymore :(
     
  10. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    OK i need to be guided for add sword annimation
    i got java script in Plugins where i send get info walking like this

    if (Input.GetKey("right")|| obj.GetComponent<GetCommand>().left == true ) {

    now i need communicate beetween SimpleCharacterInput and HeroAnimator
    for send my annimation

    help is welcomme plz

    so for start i have add

    if (animation["attack"] != null) {
    animation["attack"].wrapMode = WrapMode.Once;
    }

    case CharacterState.attack: attack(); break;

    and
    protected void sword() {
    animation.CrossFade ("attack");
    }
    i look for where CharacterState change
    for this time he say CharacterState' does not contain a definition for `attack'
    it's must be in raycast charactercontroller but it's little big for add just one annimation in speed

    ok back ! yes ! so i have found maybie the solution is add on another layer

    protected void Walk () {
    animation.CrossFade("run");

    //animation.Blend("attack",1.0f);

    animation["attack"].layer=1;
    animation["attack"].weight=0.5f;
    //animation.Play("attack");
    animation.Blend("attack",1.0f);

    CheckDirection();
    }
    it's not working like i need ! maybie other way plz




    Second try i try send

    var k = GameObject.Find("knight_prefab");
    var s = k.GetComponent("HeroAnimator1");
    s.attack();


    protected void attack() {
    animation.CrossFade ("attack");
    }

    he result animation walk don't play after
     
    Last edited: Aug 16, 2013
  11. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Next update, you can get the WIP if you send me your invoice number.
     
  12. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    What would be required for one to implement the 'enhanced slopes' themselves?

    Just modifying the jump to be on the contact.normal for OnCollisionStay, and modifying speed on an 'acceleration' till a terminal velocity, based on the rotation of the object you're colliding with?

    Craig
     
  13. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,291
    I think you have my invoice number, should i send it again?
    When you think it will come Not to far away then i think i can wait.
     
  14. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    I have strange move one mobile, So i have reduce raycast to one one one and remove hit trigger
    what's i can do more ? so stop lag in jump
     
    Last edited: Aug 17, 2013
  15. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    There are many users so its hard to keep track of this, so its easier if you just resend the request.
     
  16. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Something else is the issue. Modern mobiles can do many casts per frame (as in 100's). Again I need more information! What device? Do you have pro (If so send me the profiler report)? Is it just jump that lags? Are you sure its lag and not terminal velocity/maxFrameTime? What happens if you build the touch sample for your device?
     
  17. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    For the jump I'd set velocity.x as well as velocity.y when you jump (using trig to determine the ratio based on characters current angle). If you want jumps that increase as you hold the button you would also need to store the "jump angle" so you continue to apply velocity in the same direction.
     
  18. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Also @kilik128 its a lot easier to track complicated support issues in email so I have a history of the conversation, can set reminders, etc (plus I generally respond a lot quicker too). So I'd suggest using the email address provided in the doco.

    Cheers,

    John A
     
  19. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    Thanks.

    I meant speed with regards to sloped movement, I'm trying to implement sliding based on the angle of a slope, generate speed and them have him hug curves till the curve ends, and it shoots him out (essentially sonic style).

    Craig
     
  20. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Oh, the velocity bit should be pretty easy. Just an additional script that adds x velocity based on angle (may need to do some minor edits to core code to stop it resetting velocity when you don't want it to). X Velocity is always added perpendicular to your slope so that should work pretty well (note however that y velocity is always applied straight up and down)*. If you set the max angle higher than 360 you should be able to run around complete loops.

    The launch bit will require some extra code as once he leaves the slope you will have to translate his x velocity into x and y. Again shouldn't be too hard but probably needs core code edit to work out when character is leaving slope and make the velocity updates.

    The toughest bit will be what to do when you jump while upside down, and working with colliders so you can jump through from both directions (i.e. loops can be ran around but you can both jump and fall through them).

    In the end its not going to be a trivial piece of work, but it shouldn't be exceedingly difficult. This kind of stuff is what motivates me for version 2 of the controller where all movement will be done by pluggable modules ... of course thats a major change that completely breaks backwards compatibility so wont happen any time soon.

    - - - -

    * Yes I know that seems weird, certainly a departure from standard physics. Its basically just a simple way to handle slopes which tends to give pretty good results for most cases.
     
    Last edited: Aug 18, 2013
  21. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    Thanks for the thorough response johnny! That's fine, as essentially, you can't jump once you initiate the 'slide' - speed will be based on both slope and time, requiring you to work out when you need to start sliding to generate enough speed to hit the curves, but not overshoot - you will have to disengage from slide to begin jumping again, forcing you to fall off loops, curves etc.

    I'll see if I can get cracking on some stuff, and If I do, I have no problem with sending it through to you to take a look at and potentially use in the future.
     
  22. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    This is just some rough pseudocode I banged out, does this look roughly like it's on the right track? I don't have access to unity right now so I can't actually check it in C#, but still:

    If Raycast Collision with ground and not sliding
    // we are walking or standing
    Enable jump
    Enable movement
    Else if no Raycast Collision with ground and not sliding
    // we are jumping or falling
    Apply falling gravity logic
    Else if Raycast Collision with ground and sliding
    // we are sliding
    determine slope of object standing on, apply x, increase velocity over time till terminal velocity hits
    if slope > 180 its uphill, reduce velocity over time (?)
    Else if no Raycast Collision with ground and sliding
    // we are launching off of something
    get current velocity (x,y) and apply projectile motion (vx = v * cos theta, vy = v * sin theta)
    determine if character rotation is upside down, invert if so (have all projectile motion
    equations done as if upright)
     
  23. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Very roughly yes with some minor changes (for example I think neutral slope is 0). However given the constraints on move and jump you may able to do it without affecting core code at all (which is handy for getting updates, not affecting other things like climbing or ledges, etc). Basically I can see it as a separate behaviour that tracks if you are sliding or not implemented as a RaycastCaracterInput.

    If you are sliding it turns off manual input and instead adds velocity itself based on angle. If you are not sliding it just acts like a normal input control. If you are not sliding and you were sliding last frame it calculates your launch velocity and applies it.

    I'm not quite sure how your game "initiates the slide" (i.e. is it a player action or just hitting a certain speed whilst on a slope, or something else entirely), but enough information should be accessible from this input class to determine if you have.
     
  24. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    It'll be player initiated. Sounds great, I'll try and implement it as a separate behaviour.

    Thanks
    Craig
     
  25. nab

    nab

    Joined:
    Aug 2, 2013
    Posts:
    8
    is there a way to disable gravity input for the RaycastCharacterController ?

    example 1:
    when the player jumps right, I want right to increase the speed (in a different speed than the walk or jump speeds), and when he presses left, I want to slow him down.
    current behavior is to apply walk or run speed, and by doing so, pressing left stops the player no matter what speed he's going in.
    expected solution is to override the behavior and implement my own.

    example 2:
    I want my character to use a tool to climb a surface, and by changing the y position, the gravity keeps pulling the character down, therefore the character is juttering.
    expected solution is to disable the gravity on the character.

    Thanks in advance
     
  26. Bast-I

    Bast-I

    Joined:
    May 28, 2013
    Posts:
    18
    Hi Johnny,

    I have a question that touches on the mechanics of the platform base class. I wrote a script that helps me control the camera. Since it should only be triggered if the character sets foot on the platform, I used the decaying platform script as template, even though you mentioned that one should only use these for movement influencing things.
    So I ended up with this:
    Code (csharp):
    1.  
    2. public class MyOwnPlatformScript : Platform {
    3.    
    4.     public float somePublicVariable;
    5.    
    6.     override protected void DoStart () {   
    7.         //Do a simple calculation
    8.     }
    9.    
    10.     override public void DoAction(RaycastCollider collider, RaycastCharacterController character) {
    11.         if (collider.direction == RC_Direction.DOWN  (somePublicVariable)) {
    12.                 //Call a method on another object
    13.         }
    14.     }
    15. }
    16.  
    The script works perfectly but the price is high: if I attach two platform scripts to a gameobject -- my script and the passthrough script for example --, then apparently only the one I attach first works is working.
    What do I have to change to have them coexist peacefully? At any rate want to keep both scripts separate even though I could throw them together.

    It would be great if you could give me directions.

    Bast I
     
  27. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    The base class itself only hits one platform per foot (which kind of makes sense particularly as many platforms have parenting, how could we deicde which one becomes the parent or how do we enforce only one platform per component that is a parent).

    A simple solution would be to have a "linked platform" class which grabs a link to any other platforms at start and then calls all of them whenever one is called.
     
  28. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Firstly never change position directly. If you need to affect movement use the velocity parameter.

    You can probably achieve both the effects you want with the careful control of the velocity parameter. The basic idea would be once your behaviour is initiated (for example user presses the climb tool button ), that the behaviour will set velocity each frame until control is released back to normal. So for example with a climb tool it would set x velocity to 0 and y velocity to either 0 or climb speed each frame (until the users disengages form the climb by pressing left).

    You may need to enable wall stick and override the input while this behaviour is active too. On that point it is usually best to implement this kind of feature control as part of a custom RaycastInputController (either directly in the controller code or as an external class referenced by your custom controller).

    By using velocity you will still get the basic collision behaviour (you wont be able to climb through a roof for example).

    The alternative is to edit the main controller classes which I would suggest you don't do unless you can't achieve the behaviour using the alternative method.

    Ideally I would like to make the entire movement system modular (this is what I call the v2 release) as it will make all kinds of complex movement much easier, but that development will be a long time away.

    - - - -

    PS The character uses Physics.gravity, although separating it out so it can be overriden is something I have planned on doing for a long time I keep forgetting. I'll try to drop that in the next update as it is very simple.
     
    Last edited: Aug 19, 2013
  29. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    Hi Johnny, just wondering if there's publicly accessible variables exposed in the controller that I can access in my RaycastCharacterInput class extension, specifically those dealing with slopes. I need access to the transform of slopes (in order to determine rotation and therefore decide whether to increase, maintain or decrease speed).

    Or is better to just create the RaycastCharacterInput extension (specifying the input for slide, setting the bool), and then check that if enabled, don't take input and THEN extend the RaycastCharacterController class to handle the logic of the slide?

    I worded that pretty poorly, haha. I'm essentially wanting to piggyback off your slope code (getting the transform of the object returned by the character's raycast) so I don't have to rewrite it.
     
    Last edited: Aug 19, 2013
  30. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    fryiee: transform.rotation/localRotation ... :)

    I don't think it would be much more useful to get the internally calculated slope value (it does set a target which is transformed to over a few frames not sure if this is accessible as I don't have the code in front of me).
     
  31. gruddlebug

    gruddlebug

    Joined:
    Mar 11, 2013
    Posts:
    65
    Hello Johnny,

    The code in 1.7 RaycastCharacterControllerEditor for editFeet
    is broken and only displays one down handle which moves all feet at once!


    Code (csharp):
    1. From: (around line 76)
    2.  
    3. float y = // Blah Blah Blah
    4.            
    5.  Through To:
    6.    
    7. foreach (RaycastCollider collider in ((RaycastCharacterController)target).feetColliders) {
    8.                
    9. // Blah Blah Blah
    10.  
    11. }
    I've replaced it with the earlier foreach loop from 1.6 and it works!


    Cheers

    Paul
     
  32. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Ahh no that was done on purpose. Feet MUST start at the same y position and end at the same y position and I get a lot of issues form people who are not doing this. To stop this I made a single handle to control all of them. I was supposed to add a button/window for setting the number of feet colliders and spacing them evenly along X which I forgot to do, will drop a bug fix this weekend.
     
  33. gruddlebug

    gruddlebug

    Joined:
    Mar 11, 2013
    Posts:
    65
    Hello Johnny,

    I guessed it may have been deliberate, makes the align feet button redundant though!

    BTW Collider has a typo above the Sides:On/Off Button


    Great Work!


    Cheers

    Paul
     
  34. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    I also need to know how I can actually modify the velocity without affecting core component. This is my code:
    Vector3 down = transform.TransformDirection(Vector3.down);
    if (Physics.Raycast(transform.position, down,out hit)) {
    if (hit.transform.localEulerAngles.z > 270 hit.transform.localEulerAngles.z < 360 x < TerminalSlideVelocity) {
    x = x + SlideAcceleration;
    Debug.Log(x);
    }
    }

    How / what values should I be setting the 'SlideAcceleration' and 'TerminalSlideVelocity' to? At the moment, it doesn't speed up my character at all - I'm guessing that's because the RaycastCharacterController normalises movement greater than the editor settings in the MoveINXDirection function. I need to be able to simulate acceleration, if I could do that without modifying the core that'd be good.
     
    Last edited: Aug 20, 2013
  35. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Bit sloppy of me, I think I got half way through then got distracted. Will clean it up for the next minor release.
     
  36. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    I think my explanations might be poor. Here's a sample I put together, its messy and simple but might help you get a better feel for what I am trying to explain.

    http://dl.dropboxusercontent.com/u/60620789/2DPC/SampleBUild/SampleBUild.html

    The only code changes I made was to adapt SimpleCharacterInput as follows:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class SliderInput : RaycastCharacterInput {
    6.  
    7.     public RaycastCharacterController controller;
    8.     public bool alwaysRun;
    9.     public float acc = 1.5f;
    10.     public float drag = 0.5f;
    11.     public float fallTime = 0.125f;
    12.    
    13.     private bool isSliding;
    14.     private float fallTimer;
    15.    
    16.     void Update ()
    17.     {
    18.    
    19.         jumpButtonHeld = false;
    20.         jumpButtonDown = false;
    21.         x = 0;
    22.         y = 0;
    23.        
    24.         if (!isSliding  Mathf.Abs (controller.transform.localEulerAngles.z) > 5.0f  Mathf.Abs (controller.transform.localEulerAngles.z) < 355.0f) {
    25.             isSliding = true;
    26.         }
    27.        
    28.         if (isSliding) {
    29.             // Reduce drag each frame to make it easier to slide
    30.             controller.SetDrag(drag);
    31.            
    32.             // Add velocity based on slope
    33.             float angle = controller.transform.localEulerAngles.z;
    34.             if (angle > 180) angle -= 360;
    35.             angle *= -1;
    36.             controller.Velocity = new Vector2(controller.Velocity.x + (acc * angle * RaycastCharacterController.FrameTime), controller.Velocity.y);
    37.            
    38.             // Check for exit
    39.             if (!controller.IsGrounded(0.25f)) {
    40.                 fallTimer += Time.deltaTime;
    41.             } else {
    42.                 fallTimer = 0.0f;
    43.             }
    44.             if (fallTimer > fallTime) isSliding = false;
    45.  
    46.             // Change animation state to show its sliding
    47.             controller.ForceSetCharacterState(CharacterState.CROUCH_SLIDING);
    48.         } else {
    49.             if (Input.GetKey("right") ) {
    50.                 x = 0.5f;
    51.             } else if (Input.GetKey("left") ) {
    52.                 x = -0.5f;
    53.             }
    54.        
    55.             // Shift to run
    56.             if (alwaysRun || Input.GetKey(KeyCode.LeftShift)) {
    57.                 x *= 2;
    58.             }
    59.            
    60.             if (Input.GetKey("up") ) {
    61.                 y = 1;
    62.             } else if (Input.GetKey("down") ) {
    63.                 y = -1;
    64.             }
    65.            
    66.             if (Input.GetKey(KeyCode.Space) ) {
    67.                 jumpButtonHeld = true;
    68.                 if (Input.GetKeyDown(KeyCode.Space)) {
    69.                     jumpButtonDown = true;     
    70.                 } else {
    71.                     jumpButtonDown = false;    
    72.                 }
    73.             } else {
    74.                 jumpButtonDown = false;
    75.             }
    76.         }
    77.     }  
    78. }
    79.  
     
  37. zarkam

    zarkam

    Joined:
    Jan 3, 2013
    Posts:
    3
    Hi!
    Sorry if a little offtopic but it's related :) .
    I wonder if a good way now that I have a mecanim char jumping around and even doing some simple attacks(win 8 phone), would Rotorz Tile System be good for levelbuilding for a little game based on the 2D Platform Controller? Until now I have just used the cubes in the example scenes. Or can anyone recommend another good way to build nice worlds?
    (Using the hero based system, so no proper 2d)
    Have looked around a little, but will do some more research.
    Best Regards
    Lukas
     
  38. gruddlebug

    gruddlebug

    Joined:
    Mar 11, 2013
    Posts:
    65
    Hello,

    The latest 2D Toolkit is good for maps, it's what I use!

    I haven't used Rotorz, but as it's a dedicated tile system with tons of 5 Star Ratings, so it seems to be the go to tile solution!
    (I'll have to try it when funds permit)


    Cheers

    Paul
     
  39. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    That seemed to work pretty well in the demo, and it seemed okay in my scene also - i just modified it slightly from your check to this:
    Code (csharp):
    1.  
    2.  if (Input.GetKey(KeyCode.LeftControl)) {
    3.             isSliding = true;
    4.             controller.slopes.maxRotation = 360f;
    5.         } else {
    6.             isSliding = false; 
    7.             controller.slopes.maxRotation = prevAngle;
    8.         }
    9.  
    However it's reacting quite erratically when it comes to 'steep' slopes facing the other way (ie ramps), see sample here:
    http://excaliburdesign.com.au/smokerisestest/smokerisestest.html

    It's essentially hitting a 'dead stop' once it goes above flat. The colliders underneath that are just uniform box colliders creating the curve (done via ragespline). I'm assuming it's a combination of the slope lookahead and rotation time? (because its a 'quick' change in slope angle)? Would changing these / adding another collider alleviate this issue?

    Slightly unrelated, but are there any conceivable workarounds for the 'spin' a character exhibits when it runs into a slope is above its maxrotation? Or is it just a case of positioning a vertical box collider in affected areas to ensure it doesnt happen?
     
    Last edited: Aug 20, 2013
  40. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Are you sure your side colliders aren't hitting the opposite slope? Thats what it looks like to me. In that case you can raise them up a bit (or maybe turn the bottoms one off when sliding).
     
  41. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    That looks to be the solution! I inserted parts to move the bottommost colliders up during a slide, and it seems to be working a treat. Thanks johnny. Any ideas on alleviating that 'spin'?

    Also, now that RaycastColliders are deprecated, will that have any problems moving forward seeing as the colliders use them?

    EDIT: Sorry for asking so many questions! Haha. Thanks.
     
    Last edited: Aug 21, 2013
  42. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    RaycastColliders are deprecated? That's just the name I've given to the "lines" that detect collisions on the character and I'm certainly not deprecating them. It uses the standard Physics.Raycast().

    Can you explain what you mean by spin? I cant remember if it snaps to position or lerps to position, but there has to be some way for the controller to restore itself back to horizontal after going passing the max rotation. I'm guessing you want it to do the opposite of what it does now... or maybe you want it to stay at max (which is probably going to be somewhat complicated).
     
    Last edited: Aug 21, 2013
  43. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    Haha my mistake. There was actually a class RaycastCollider back in Unity 3 that I got confused with when I saw it.

    Yeah, essentially if you're in a corner and try to force it up, especially on curves, it'll get to its max then right itself, resulting in 'spin'. These are easy to find though, and I can just 'block' them off with a vertical box collider to alleviate problems on a geometry by geometry basis.

    Thanks
    Craig
     
  44. fryiee

    fryiee

    Joined:
    Jan 28, 2013
    Posts:
    18
    EDIT: Nevermind, think it's still having problems with the side colliders stopping motion at higher rotations.
     
    Last edited: Aug 21, 2013
  45. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039
    Depending on level-geometry you can probably just turn them all off (while sliding).
     
  46. nab

    nab

    Joined:
    Aug 2, 2013
    Posts:
    8
    I upgraded to 1.7, and using a ladder now makes the character disappear, the mesh renderer (a simple cube) and game object of the player is still active, but it's not rendered in the camera.

    note: I'm starting the level with the ladder disabled and then enable it.
    (kinda as if a character is throwing a rope graphically, while behind the scenes it's activating and moving a disabled ladder)
     
  47. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,039

    I can't really say I have specifically catered for ladders that act like that. That said given the renderer is still enabled there's two likely possibilities... the character is behind another mesh or the character is transformed out of range of the camera. Can you confirm which.

    What are the ladder settings (on the LadderControl)? If its a "ledge climb" ladder (the one where you pull yourself up to the top automatically using a ledge climb like animation) then it sets some values on start which would need to move if the character changes y position. Can probably make a small adjustment to fix that.

    Anyways send me some details and we can dig deeper.

    - John A
     
  48. nab

    nab

    Joined:
    Aug 2, 2013
    Posts:
    8
    hmmm.... it's neither of them, but, I tried to repeat the process by creating a new project and re-producing the issue, but couldn't.
    maybe because I moved the files to different folders, and when updating i still have some files that were removed ?

    I'll try to re-import the plugin and let you know how it goes.

    Edit: after spending so much time trying to restructure the project.
    turns out the problem was the character getting scaled to (0,0,0).
    still not sure if it's the fault of my code or the plugin, but since it wasn't reproduced, I'm inclined to think it's my fault.
    thanks for the support anyway.

    Edit2: turns out it was caused by me rescaling the ladder (didn't want it to go full length while the rope stopped at 50%).
    so, scaling the ladder object to less than 1 in height, scales the character to 0,0,0
     
    Last edited: Aug 22, 2013
  49. blaize

    blaize

    Joined:
    Jul 25, 2012
    Posts:
    41
    Hey JohnnyA,

    Any chance you have an idea when you'll be working on simple combat with AI?
    Also, is a swimming feature planned?
     
  50. tonyel4

    tonyel4

    Joined:
    Jul 4, 2013
    Posts:
    10
    Hi!

    Do you have an idea of how to implement wall sliding for moving platforms?