lemminglion
lemminglion
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
Apologies, fixed some issues with jump handling, it needs some tuning of variables but this acts basically the same as Jump King
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
Its unrefined but implements various things from JumpKing: 1. walk left/right when not jumping 2. Jump up 3. Jump and leap in a direction (assuming the player did it fast enough) 4. Don't allow air control, once the player is leaping they're stuck leaping in that direction 5. Kill all momentum when the player touches the ground 6. Bounce off walls if you hit them
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
@Smikkelbakje If you're still stuck with this, I can confirm this works kinda like how Jump King does. Its not 1 to 1 but despite how simple it may look its actually a fairly hard jump routine. You will need to configure some gameobjects in the scene to act as Left/Right Walls or Floors via tags. I've sent the sample scene to use it too (it may require updating to whatever version of Unity you have installed)
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
Not as feature complete as yours, it lacks the wall finding stuff. However I think that's doing what you wanted 🙂 You may have to adjust the values in the inspector as I was just doing it with a 1x1 cube
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
So there are a lot of things going on in that script, some of which from what I can see of your game isn't required for what you're wanting to do. Give me a few mins I'll write up some example code
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
So depending on how you want your character to move, you have to balance the amount of force being added vs the amount of drag. There's quite a few ways to do it so its more about trying different solutions until you get one that feels right
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
Yep thats more 'normal' In the Rigidbody in Unity's inspector, increase the drag
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
I would try replacing all the rb.velocity = with AddForce calls. You will need to adjust the multipliers (in this case WalkSpeed) to possibly much bigger numbers as AddForce imparts energy to the rigidbody as though something hit it in X direction
27 replies
CC#
Created by Smikkelbakje on 1/4/2023 in #help
❔ slide bug in csharp script in unity
rb.velocity = new Vector2(moveInput * walkSpeed, jumpValue); is possibly wrong in your use case here. When you do this its immediately overriding the horizontal (sliding) momentum by setting a new velocity directly. Its not ideal to set velocity directly unless that's exactly what you need to do. Instead, use AddForce https://docs.unity3d.com/ScriptReference/Rigidbody2D.AddForce.html The line you want is likely: rb.AddForce(rb.transform.up * jumpValue);
27 replies
CC#
Created by lemminglion on 1/4/2023 in #help
❔ 'Observable' does not contain a definition for 'Create'
Nb. This issue has now fixed itself despite not changing anything in the past hour. Best guess it was rebuilding a cache or something in the background :/
3 replies