-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Additional Player Actions #55
Comments
That's because the current motor architecture isn't that great at states working together :p The motor originally just handled basic character locomotion (moving, jumping, and dashing). Ladders were an awesome addition by someone else but are somewhat placed on the previous architecture. What should happen, ideally, is a clear cut distinction of what mode you're in and that mode's functions get called. So you would be in locomotion mode, dash mode, ladder mode, or rope mode (and ideally any other modes can be added here). Arguably picking up and throwing don't need to exist inside the motor (as it the actions don't have anything to do with moving) but once you've thrown then you can attach to the rope. |
I suppose that's very true - I was just looking at what already existed and was very trapped within that headspace. :P I was thinking about just reversing the principal of the moving platforms so that rather have the motor attach to something else, the something else attaches to the motor. But you're right, I don't have to do it that way. For the most part I've figured out which steps I need to take to set up sprinting, it's just a matter of where. This is what I've managed to put together so far for sprinting: And this is what I think I still need to set up: I'm just not sure what the most effective way to do this would be. I'm a little lost in the very long PlatformerMotor script. Any help is appreciated (even if it's just me talking through the problem here). |
It sounds likes you're on the right path. All sprinting is is the change of acceleration, max speed, and deceleration. Being able to query for animation purposes is nice too. The two functions that really care about those properties is GetSpeedAndMaxSpeedOnGround (2580) If those two functions picked the right values depending on if you're sprinting or not then that'll do it (and a query for IsSprinting should be sufficient). There's also the consideration on if sprinting is allowed in the air, which is just changing the speed, acceleration, and deceleration values when in the air too. And yes the motor is very long, way to long :) When I get the time to come back to this package I want to refactor it into something more manageable. |
Awesome, thanks a lot. It helps to know I'm heading in the right direction! I can't wait to see what additions you will make in the future! I've read the license over but I also wanted to clarify that as long as the license is contained within my project, your controller could be used in a commercially sold game that I make? |
Yea that's fine. Basically you can't take the controller and just sell it as a package. |
Hey, sorry to bother you again. I got sprinting and crouching working! I was wondering if you might have a suggestion for this dilemma... I'm using the 2D controller on a 3D object strictly for the art style (going for a 2.5D style). I created some animations for my player character - for example, the idle turns to the camera and waves. Because the motor is built for 2D and mainly for sprites, any rotations on the Y and Z axis are ignored and the model snaps back to the default position. Can you think of a way we could get around this for a few animations? |
Set your visuals on a child object and you'll be able to rotate or animate On Fri, Jul 15, 2016, 5:56 PM meghapants [email protected] wrote:
|
Ugh. Such an easy answer. I was way overthinking it - but it also helped me find a major flaw in the way I set up my prefab. I was pulling my hair out because the Animation script was working in your test scene but not with my prefab. Thank you. |
Wow @meghapants, I was also thinking about expanding this awesome controller with swinging, but I don't know where to start (I'm not so experienced). I treated a rope (made of little squares with hinge joints between them) as a ladder, and it works, but the player moves so laggy. Any idea? |
I try to implement those things in the past for this library, after working on it I just abandon it because it has no concept of movement and adding something is very uncomfortable. Water & grab box (box2 branch): https://github.com/llafuente/Unity-2D-Platformer-Controller/commits/box2 If you want rope implementation: |
Thanks a lot @llafuente, I'm going to check this. I hope to understand what you did here and how to implement it :) |
Hi,
First of all, thanks for making this awesome platformer controller! I'm pretty new to programming but I've been able to deconstruct a fair amount of what you've done with it and it has been a fantastic starting point. It's very smooth and feels great.
I've been trying to implement a few of my own features but because of my limited programming experience I've been struggling a little bit. This is what I've been hoping to add:
-Sprinting
-Picking Up
-Throwing
-Crouching
-Rope swinging
I think I've been making some progress on sprinting, because it's the same principal idea as moving, just faster. Same goes for crouching really, but half movement speed. The biggest challenges I'm facing are picking up, throwing, and swinging.
The ladder script has given me a good basis for ropes, but it's very stationary. Ideally I'm trying to have the player throw an object to a hook on the wall, then jump onto the rope and be able to swing from side to side, and climb up and down on the rope.
I've determined the easy parts - creating new motor states and receiving the proper input for the required actions. With the combination of scripts I'm just a little lost trying to figure out how they all work together. Even just some direction on where to work these new features in would be greatly appreciated!
The text was updated successfully, but these errors were encountered: