#Cursor and Physics

3 messages · Page 1 of 1 (latest)

naive plaza
#

I want to have my cursor interact with physics objects and push them around. I am currently doing this by hiding my current cursor and using a CharacterBody2D to follow my cursor position. The issue I am having is the cursor doesn't actually seem to be able to push my objects very well (It is not using enough force). What can I do to make the cursor hit with more force (or if possible use the speed at which I am swinging my cursor to calculate force)?

extends CharacterBody2D

@export var empty_cursor : Texture

func _ready():
    Input.set_custom_mouse_cursor(empty_cursor, Input.CURSOR_ARROW)
    
func _process(delta):
    move_and_collide(get_global_mouse_position() - global_position)
golden patrol
#

CharacterBodies aren't great for interactive physics.
You probably want to use a rigidbody here. Its mass and velocity will have a realistic impact in collisions

#

But they are managed by the physics engine and can not just be moved around like that