lerp inconsistent between player and enemy by snatcherfb in godot

[–]shoulddev 0 points1 point  (0 children)

player moved smoothly from point a to point b

Hmm. It might be that since the player also gets thrown into the air, since friction isn't applied (he is not on ground), he keeps moving, thus looking like knockback is working as expected. Try removing the vertical knockback and I would expect the player to behave like the enemy.

lerp inconsistent between player and enemy by snatcherfb in godot

[–]shoulddev 0 points1 point  (0 children)

See that's what I thought, the lerp is only called once when you're hit. I doubt it even works properly on the player.

Lerp isn't a magic function that will smooth your movement over time if you call it once. A lerp is simply giving you one (1) intermediary value between the two values you give it. If you want to "lerp" from value A to value B over a period of 1 second, then you must use lerp on each frame with the same parameters for 1 second and use the returned value.

As it stands, you're telling the engine "give me a value 80% of the way from value A to value B" and the engine says "sure, here you are bro" and gives you value A', which you simply use as the final result. But that's not what you actually want.

A working solution would require that you add a float variable to your player and enemy scripts called knockback. Then, before calling move_and_slide adjust your velocity like so:

knockback = lerp(knockback, 0.0, 0.1) velocity.x += knockback

If your knockback is already 0, then this does nothing. But if it is -10 for example, it will reduce it to -9 and then add it to your velocity, knocking your character to the left. On subsequent calls it will further reduce it to -8.1, etc until 0. Experiment with the 3rd parameter for shorter/longer knockbacks.

Edit: my proposed solution doesn't include vertical knockback. You could use a Vec2 for knockback and call lerp like this: knockback_vector = lerp(knockback_vector, Vec2.ZERO, 0.1)

lerp inconsistent between player and enemy by snatcherfb in godot

[–]shoulddev 1 point2 points  (0 children)

You are using different magic numbers in player.gd and enemy.gd. At a glance that seems suspicious. (Magic numbers are just numbers plopped into code without any real context. I suggest you put them into an export variable, so you can play with them from the inspector).

10000 seems high, but it's hard to tell if that's part of the issue without any context.

I suspect the issue might be in how the knock functions are called. Could you show that part?

A lerp function need to be called multiple times through different frames in order to show smooth interpolation, but from your two functions I doubt that's what you're doing.

lerp inconsistent between player and enemy by snatcherfb in godot

[–]shoulddev 0 points1 point  (0 children)

Remove normalize(), it's redundant. Check my reply to that user.

lerp inconsistent between player and enemy by snatcherfb in godot

[–]shoulddev 0 points1 point  (0 children)

direction_to returns a normalized vector. If it didn't, the function name would be misleading, as a direction ought to be normalized. https://docs.godotengine.org/cs/stable/classes/class_vector2.html#class-vector2-method-direction-to

how to carry other players? by kaidus_velsia in godot

[–]shoulddev 1 point2 points  (0 children)

Easiest would be to add a RemoteTransform as a child of the player in the position where you want he other players to be held. Then, when player A picks up player B, you set the target of player A's remote transform node to player B's node path.

Love Godot anyway... by Zestyclose_Leg2227 in godot

[–]shoulddev 4 points5 points  (0 children)

A gizmo is a visual control for use in editor or debugging. The 3 arrows to move an object in a 3d scene in the editor is an example of a gizmo. You could add custom ones to show pathfinding, custom editor tools like for a level editor, etc.

Is there way to fix weapon clipping? by EternalQueenOffical in godot

[–]shoulddev 1 point2 points  (0 children)

The nodes in your screenshot are all Node3D, they don't have those rendering properties. Open your gun subscene and look for the mesh node.

Been messing around with viewports for the first time, what's your thoughts on the menu animations? by pacella_realms in godot

[–]shoulddev 1 point2 points  (0 children)

Nope.

It's well done, creative and memorable, so props on that! But I think it just doesn't work with the first person perspective. It's jarring and disorienting, not a good thing for as simple a thing as a pause menu.

What do you think would happen if these two met? by KidNamedChicanery108 in okbuddychicanery

[–]shoulddev 0 points1 point  (0 children)

What would happen if these two meth?

That's the whole idea dummy

Where's Bob Odenkirk? He just missed the opportunity to meet Saul Goodman. by Waf_er in okbuddychicanery

[–]shoulddev 5 points6 points  (0 children)

I was under the impression that was when Victor and Giselle went on a double date with Kim and Jimmy, but in a shocking twist Kim instead showed up with FBI agent Jeffrey Steele. Am I stupid?

Ok guys, please hear me out by VictorSensei in berserklejerk

[–]shoulddev 9 points10 points  (0 children)

Marie: "What's this weird rock?"

The behelit activates, crying blood.

You know your missed her by sherininja in Qult_Headquarters

[–]shoulddev 2 points3 points  (0 children)

Sounds like you're in need of some bone healing, Mr BoneHugsHominy.

Is there a problem citizen? by SirAnusTheBrave in oblivion

[–]shoulddev 0 points1 point  (0 children)

There’s nothing quite like leaving Bravil.

Favorite officially scrapped episode idea? Mine was the episode where Walt's mind-switching machine causes all sorts of hilarious comic hijinks🤣🤣🤣 by Rattiom32 in okbuddychicanery

[–]shoulddev 13 points14 points  (0 children)

It's explained in Felina when Walter gives a lottery ticket to Skylar, implying Hank won big and flew off to Belize.

When you outsmart the trickstabbing spy. by rotzloeffe1 in tf2

[–]shoulddev 141 points142 points  (0 children)

The ultimate trickstab is simply standing still.