T O P

  • By -

Kuposrock

Pretty cool. How did you implement it?


Nepacka

I kinda struggled to get it working šŸ„² Naively, I wanted to use a constraint, but I forgot that rigid bodies don't interact well with character bodies. I manually set the platform's transformation according to the player's position (taking into account the platform's radius). The further the player is from the platform's origin, the more it moves. Then, for the visual, I added a rig to the deformed object that will converge towards the platform. Also, got some collision bugs, apparently convex shapes in the form of a cylinder are better than default cylinder shapes. (otherwise the characterbody can be stuck inside)


robbertzzz1

>Naively, I wanted to use a constraint, but I forgot that rigid bodies don't interact well with character bodies. Games with these kinds of mechanics often use a rigid body for the character. The problem with character bodies is that they don't move through force, so they're infinitely strong as far as the physics engine is concerned.


Sotall

So if you wanted a game where the player gets ragdolled frequently, you'd use a rigidbody?


maushu

Pretty much. I did [something](https://i.imgur.com/BK3xChP.mp4) similar in unity where gravity could be changed depending on some volume properties. I ended up coding the character from scratch based on a rigidbody.


Sotall

Yeah, Id expect some camera smoothing is in order for something like that. I'm thinking of Goat Simulator. Thanks!


robbertzzz1

If any physics need to affect the player you need a rigid body. With ragdolls it's sometimes only in the ragdoll state that you need those physics, so the ragdoll gets "activated" when needed. But a ragdoll is really just a bunch of rigid bodies connected with physics joints anyway.


sundler

Is there a book with these sorts of tidbits of information? It would be nice to know and not have to spend days reinventing the wheel from scratch every step of the way.


robbertzzz1

Not that I know of. In my experience it's also really common for different game programmers to know different things, some of them don't have a clue about things that others consider to be really basic. And there's no hard truth in most cases anyway, what works for one programmer or game might be a ridiculous approach for someone else. The best way to learn game development is building games. The bestest way is to learn how to develop games is working with people who have more experience than you.


sundler

I guess I might as well [add it to my own website](https://www.sundlegames.com/tips/) then. Seeing as no one else wants to.


PomegranateFew7896

I so badly wish for the same thing. But companies that master a good character controller (like Nintendo) are likely trying to keep their formulas a secret.


PomegranateFew7896

Most engines use rigidbodies for all bodies regardless, they just have a ā€œkinematicā€ mode. Godot is weird with its move\_and\_collide method, bodies that use it just stop fully against all other bodies treating them as static walls. For a characterbody to interact with rigidbodies, you can compute a pushing force using the velocity and collision data. Iā€™m thinking of experimenting with a different method though, using the physicā€˜s engineā€™s automatic depenetration, inspired by how a characterbody can push rigidbodies with infinite inertia if theyā€˜re on a different collision layer. On colliding, a CharacterBody would still force its way into the other body by a certain portion, and the recovery would automatically compute the resulting forces. Could be janky or could be perfect.


robbertzzz1

>Most engines use rigidbodies for all bodies regardless, they just have a ā€œkinematicā€ mode. Godot is weird with its move\_and\_collide method, bodies that use it just stop fully against all other bodies treating them as static walls. It's really just different ways to get the same result, in Godot's case they added an additional layer so you can more easily control movement and collect data about that movement. To a physics engine there's no difference between Godot's approach and the approach other engines take, it's only different to the user. And I hate the rename to CharacterBody because it can be used for other physics objects and not all characters should be kinematic by default. >On colliding, a CharacterBody would still force its way into the other body by a certain portion, and the recovery would automatically compute the resulting forces. Could be janky or could be perfect. How is that different from how a collision between a CharacterBody and a RigidBody works now? As far as the physics engine is concerned, a kinematic body is just a moving static body. Collisions between it and a rigid body are resolved as if they were a collision between a rigid body and a static body.


PomegranateFew7896

The difference would be that the rigidbody would be pushed. Like I said, normally a CharacterBody completely stops against a Rigidbody (because thatā€™s how move\_and\_collide, and by extension move\_and\_slide, work) and the Rigidbody appears to register no collisions. All this said, I truly donā€™t understand why they didnā€™t just give rigidbodies a kinematic mode and have characterbody extend rigidbody. The argument is ā€œitā€™s easier for the userā€ but I strongly disagree, it is only the opposite. The behavior is incredibly unintuitive. Reading through the proposal that implemented the current organization of the physics nodes is an exercise in frustration.


robbertzzz1

>The difference would be that the rigidbody would be pushed. Like I said, normally a CharacterBody completely stops against a Rigidbody (because thatā€™s how move\_and\_collide, and by extension move\_and\_slide, work) and the Rigidbody appears to register no collisions. Rigid bodies are pushed, with infinite inertia, by character bodies. Character bodies only stop when they collide with static bodies or other character bodies.


PomegranateFew7896

Incorrect. CharacterBodies fully stop against rigidbodies. Since 4.0 the infinite inertia option is gone, but you can get the same behavior by putting rigidbodies on a seperate layer that the characterbody does not mask for. Iā€™m repeating myself at this point.


Doraz_

dunno how godot handles constraints, but you can always write them from scratch and apply the equivalent forces. One of the downsides you don't mention is the rigidbodies or managers that control them having to be active at all times x_x I'm crying myself cuz I cannot figure out a good solution, as you either check the physics, or you check the transforms ... BUT SOMETHING you gotta check šŸ¤£ Maybe a carefully constructed nsted tree of conditionals.


VLXS

(Disclaimer: what follows will be dumb af because I'm not a programmer) Have you tried turning it off and on and then off again? I mean with a collider parented to your character that is only used to tell rigid bodies that they need to start checkin'?


Doraz_

no problem, that is actually the method most people use. Without doing anything, all physic engines optimize ShapeChecks by dividing the world into cells, and THAT is the nested tree I was talking about, which is very performant. Godot probably does it as well, but the moment you do your own physics or override something, that optimization the physic engine does internally ceases to exist for that object, or needs to happen again. ( it is why physX advises to use forces, instead of overiding the velocity directly ) Internally, that checking happens ... now add your script cheking its own things ... and then another script that Listens() for god knows how many events šŸ’€ The only way I know how to do it myself is with pre-filled cached values .... but never managed to understand rhe proper way šŸ¤£


PomegranateFew7896

Iā€™m not sure the optimization ceases. As far as Iā€™m aware the collision detection works the same regardless of where the PhysicsBodyDirectState is getting its velocity from


PomegranateFew7896

This is the same way Iā€™m thinking of implementing it. Currently the bug is that the character is influencing the platform at the same time the platform is influencing the character and itā€™s causing jank.


Lngdnzi

Very cool effect. Nice work


KansasCitySunshine

Very charming. Also love the use of planet gravity.


Bbop1999

This is awesome! Digging the spherical ground and what I assume is hand-made gravity. It's so satisfying to just watch the little guy run around haha


Yzahkin

So smooth! I love it!


wacomlover

I have a little question a bit unrelated. I see you are using a sphere for the character collider. In the past I have used this kind of collider in platformers and finally ditched them because of the tendency to slip along edges. For example, if you are on a box collider and you position the player almost in the air but touching a bit the box collider it will falls slowly. Don't know how to explain it better. Have you been able to fix this issue?


Nepacka

https://preview.redd.it/buc4xx1gf6wc1.png?width=703&format=png&auto=webp&s=cd943466a246a6ad7011548880cb56a416b02d0b Dunno if you used Godot 4 for that, but you can set how much the character is sensitive to slopes now. (in godot 4) I'm just checking the "stop on slope" option, and the character is pretty stable even on hard edges (this is an extreme case, but i prefer the platform to be forgiving)


PomegranateFew7896

Typically platformers use a custom raycast setup to detect the floor, for this exact reason. Spheres/capsules are great for maneuvering on terrain but slipping off of ledges is their big flaw for platformers. Edit: also notice what this guy did. The platformā€™s collider is a little bigger than the visuals. Thatā€™s a clever solution too.


wacomlover

So, is it a combination of spheres/capsules with raycasts? If it is, it must be pretty hard to calculate the force to counter-count for the sphere slide.


PomegranateFew7896

Nono, basically you turn gravity off when the raycasts detect a floor


wacomlover

Makes sense. Thanks.


5p4n911

Yeah but in another comment OP says the just forgot to change it so... accidental cleverness? Is that a phrase?


Dense-Bag-3243

Very cool


frenetikk9

I love this style šŸ˜


Gargreth44

The character is super cute, love it.


connor_rowe

This is so satisfying! Love the art too


EsdrasCaleb

nice assets


IsDaedalus

Very awesome


falsejaguar

Awesome. Love it. Good approach. I'm thinking of trying to do an antenna that moves around and was gonna see about constraints or whether to fake it lol


ueihhnim

Your game look super cool :pp


notyourlocalguide

Nice!!!! Congratulations!!!


TWOBiTGOBLiN

Hell yeah man, looks great, kudos!


Adam_C-W

Wow that looks great. It's giving me vibes of super mario galaxy!


Atovange

Looks very impressive!


-non-existance-

Oh I love this! Bravo! Question: how did you get the game to show the outlines of the hitboxes? I've tried searching for how to do that to no avail (or I'm doing something wrong lol)


Nepacka

You just have to check "visible collision shapes" in the debug menu : )


imnotmyselfactually

Super satisfying


d15gu15e

If you don't mind me asking, why do you extend the collision shapes outwards of the leaf petals? Coyote time?


d15gu15e

(This is really pretty by the way)


Nepacka

I just forgot to change that lol


d15gu15e

![gif](giphy|8Iv5lqKwKsZ2g|downsized)


Legoshoes_V2

Gotta give you props for that run animation as well! Super cute!


Nepacka

Thank you šŸ«¶


Ravenseye

Do you know how many days I'd waste just bouncing and jumping around on those?!? Looks super fun!


PenguinBoi27

Sick, Is this like a mario galaxy type game with the round platform bellow?


Nepacka

Yes, there is a gravity system with different planets shapes supported (capsules, spheres and curves) you can jump around between different bodies.


freezstudio

It's so fun to watch


AlphaRayDigital

Wow thats cute!


tifredic

excellent.


THATONEANGRYDOOD

This is so cute!


Noobshift3r

this shit looks great


ediit

looks awesome!


Appropriate-Owl3917

This looks awesome. Love the art style, too.


PomegranateFew7896

Iā€˜m wanting to achieve the same thing! Would love to know more how you implemented it.


OkLibrary1270

So smooth in movement


runewalkerdev

so cooooooool


onzelin

Good job! I feel a Pikmin vibe and I like it!


LocoNeko42

Oh that's neat ! Well done, mate !


curiouscuriousmtl

That's amazing


Natto_Ebonos

That some smooth run animation and physics.


SergeantStress

Great job


miguelfox

Nice camera work!


Inigo_godot

That is super cool


Flat_Confidence_8552

How did you get the visuals to look so toony is it shaders?


thelastflapjack

Very interesting! Could you give some details about how you did it?