Giter VIP home page Giter VIP logo

wigglebone's Introduction

WiggleBone Plugin for Godot Engine (4.x)

Adds jiggle physics to bones of a Skeleton3D. It reacts to animated or global motion as if it's connected with a rubber band to its initial position. As it reacts to acceleration instead of velocity, bones of constantly moving objects will not "lag behind" and have a more realistic behaviour.

The node inherits from BoneAttachment3D and can also be used as such. It overrides the bone's global pose respecting the current pose, so the bone pose still be animated.

See the examples directory for some examples.

Note Requires Godot 4.x. For Godot 3.x, see the 3.x branch.

Editor Example

Installation

  1. Search for wigglebone in the AssetLib editor tab
  2. Download and install the plugin
  3. Enable the plugin in the project settings via the Plugins tab

or...

  1. Clone this repository or download the archive
  2. Copy the folder addons/wigglebone to your project's addons folder (create it if needed)
  3. Enable the plugin in the project settings via the Plugins tab

Usage

You can now add WiggleBone nodes to a Skeleton3D. See the example scenes in examples.

Node Properties

Title Name Description
Enabled enabled Enables or disables wiggling. When disabled, the bone returns to it's current pose.
Properties properties Properties are stored in a separate WiggleProperties resource type.
Constant global force const_force_global This applies a global constant force additional to the gravity already set in WiggleProperties.
Constant local force const_force_local This applies a constant force relative to the bone's pose.
Bone Name bone_name Inherited from BoneAttachment3D. Selects which bone should be used.

Warning Should work when BoneAttachment3D.override_pose is true. Using BoneAttachment3D.use_external_skeleton is not supported yet.

WiggleProperties Resource

Properties are stored in a separate WiggleProperties resource type. This way, bone properties can be reused (saved) and shared between multiple bones, for example, on symetric bones.

Title Name Description
Mode mode Two different pose modes are supported: Rotation and Dislocation.
Stiffness stiffness This is the bones tendency to return to its original pose. The higher the value the stronger the pull.
Damping damping Reduces the bones motion. The higher the value the slower it moves in general.
Gravity gravity The force pulling at the tip (mode Rotation) or origin (mode Dislocation).

Additional Properties for Pose Mode Rotation

Title Name Description
Length length This defines the bone's length. At its end is the point at which gravity and other forces are pulling. This is required as the length influences the motion.
Max Degrees max_degrees The maximum number of degrees the bone can rotate around it's pose.

Additional Properties for Pose Mode Dislocation

Title Name Description
Max Distance max_distance The maximum distance the bone can move around its pose.

Pose Modes

Two different pose modes are supported.

Rotation (WiggleProperties.Mode.ROTATION)

The bone rotates around its origin relative to the its pose. The rotation angle can be limited using Max Degrees (max_degrees). It has an upper limit of 90° due to the implementation. All values have a soft limit.

Dislocation (WiggleProperties.Mode.DISLOCATION)

The bone moves around its origin relative to its pose without rotating. The distance can be limited using Max Distance (max_distance). All values have a soft limit.

Functions

This functions can be called on the WiggleBone node.

apply_impulse(impulse: Vector3, global := true) -> void

Adds a single impulse force for the next frame. If global is false, the force is relative to the bone's pose.

reset() -> void

Resets movement and resets the bone to its pose. Can be used, for example, after "teleporting" the character (moving instantaneously a long distance) to prevent overshooting.

Testing in Editor

When a WiggleBone node is selected in the scene tree, a force can be applied to it by dragging its handle. The handle appears at the bone's end when Rotation mode is used or at the origin when Dislocation mode is used, respectively. Another way is to drag or rotate the Skeleton3D or one of its parents.

Disabling Editor Gizmo

The editor gizmo (cone/sphere) can be hidden in the 3D viewport by disabling it in View > Gizmos > WiggleBone

Breaking Changes from the Godot 3.x Version

  • mass_center (Vector3) was replaced by length (float)
  • const_force was renamed to const_force_global

wigglebone's People

Contributors

detomon avatar petterthowsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wigglebone's Issues

Chain does not seem to work correctly and is very stiff

Godot version

4.2-beta2

Issue description

I've added a few wiggle bones in an attempt to make the cape move but it's very stiff and the mesh doesn't seem to follow.

Any thoughts on this? I tried a bunch of different settings without much luck.

I've tried with and without external skeleton as well and override pose

Steps to reproduce

External skeleton:

simplescreenrecorder-2023-10-22_22.06.25.mp4

image

Not external skeleton:

simplescreenrecorder-2023-10-22_22.18.45-compressed.mp4

image

Please add or link a getting started guide

Godot version

v4.1.1.stable.official [bd6af8e0e]

Issue description

How do I install and use this plugin? I checked out the git repo and copied the addon files to my godot and restarted godot but I can't find "wiggle" anywhere? Can you add a getting started guide to the readme?

Steps to reproduce

attempt to use the addon. Notice there are no instructions about how to install and get started.

Having trouble.. (With a skeleton/mesh.)

Godot version

v4.2.2 Stable

Issue description

Hello! I'm currently having big trouble trying to implant a jiggling tail with the addon. As I can't figure out how to push the tail down, So it just keeps a singular position, But can move remain moving forward and back, As well as

I'm having trouble giving it the ability to make it move left and right! (the gif linked will show the jigglebones addon being used, Which allowed this stuff.)

GPGRVTrXIAEtvT2.mp4

Steps to reproduce

(Currently, My best advice is telling you to find a low poly model on Sketchfab, And ensure it has proper rigging for its tail. Before doing this!)

Issues calling static functions

Godot version

v4.1.3.stable

Issue description

Function calls to _project_to_vector_plane and _clamp_length_soft are throwing warnings in Godot 4.1.3 in wiggle_body.gd on lines 184, 185, 201, and 210. Adding WiggleBone. before calling them resolves it. The issue is a static function being called from an instance and apparently it prefers being directly called.

Steps to reproduce

Install and enable the plugin into Godot 4.1.3, include the node on a skeleton and start the game. Game runs, but warnings are thrown.

jiggle physics magically stopped working properly (semi-fixed now?)

Godot version

v4.2.2.stable.official

Issue description

2024-06-19.04-21-06.mp4

above is a video showing the issue, whenever the character moves the wigglebones seem to clip into her as she moves around instead of jiggling like normal (and this applies to all characters with wigglebones), i have zero clue what caused this and have exhausted pretty much all possibilities like changing the physics settings and deleting physical bones (both didn't work)

weirdest thing is that i reverted to an older version of the project where theoretically this didn't happen and this still happened???? i have no clue what to do and think that wigglebone just magically stopped working or my game project is haunted

2024-06-06.05-21-55.mp4

here's a reference video from back when it did work properly

Steps to reproduce

i have no idea to be honest

Godot 4.1.3: The variable type is being inferred from a Variant value

Godot version

v4.1.3.stable

Issue description

Recieved a parse error in the console upon importing the plugin into Godot 4.1.3 that reads, "The variable type is being inferred from a Variant value, so it will be typed as Variant". This happens on line 252 in wiggle_bone.gd. Basically Godot doesn't know how to type cast it. To fix, simply apply the type.

var h := max(0.0, k - abs(a - b))

to

var h: float = max(0.0, k - abs(a - b))

Steps to reproduce

Import the plugin into 4.1.3.

Function argument variable name matches variable name in class

Godot version

v4.1.3.stable

Issue description

The argument for he function accelerate in wiggle_bone.gd on line 270 uses the same variable name ('a') as what already exists within the class. Renaming the variable for the function argument would resolve the warning.

Steps to reproduce

Install and enable the plugin into Godot 4.1.3, include the node on a skeleton and start the game. Game runs, but warnings are thrown.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.