Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.
This repository was archived by the owner on Jun 29, 2024. It is now read-only.

ask for help, the rigidbody sword slides sometime #116

@pixelcrab123456

Description

@pixelcrab123456
Clipchamp.mp4

I dont know could I ask for help there ,I'm using Godot 4.2 with Box2D 0.9.11, the sword moves by rotating, which usually works fine, but sometimes it slides forward as if it has no friction. Could some give me some direction on how to solve this problem?

the sword is rigidbody with a collision polygon2D

the polygon2D:

Screenshot 2024-06-29 022053

the code :
`var torque = 15

func _physics_process(delta):
var mouse_pos = get_global_mouse_position()
var dir_to_mouse = (mouse_pos - position).normalized()
var target_angle = atan2(dir_to_mouse.y, dir_to_mouse.x)

var delta_angle = wrapf(target_angle - rotation, -PI, PI)
var angular_speed = delta_angle * torque
angular_velocity = angular_speed`

I would be very grateful even if someone just gave me a hint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions