#Velocity in RigidBody seems to be capped by continuous collision detection

1 messages · Page 1 of 1 (latest)

lost igloo
#

As title suggests.
I'm working on a Pong Like. At high velocity the ball would pass through the colliders of paddles. This isn't inherently an issue, but since there was an option I thought I would see what continuous collision detection did.

After each bounce, I increase the velocity. Around 1000 it seems to reset when CCD is enabled. (I'm using raycasting if that makes a difference).

extends RigidBody2D

@export var start_velocity: Vector2


func _ready():    
    apply_impulse(start_velocity)
        
func _on_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):    
    apply_impulse(linear_velocity*0.1)

I performed a search and looked through documentation, with little luck. Am I missing something?

terse ferry
#

I haven't had any issues with "speed limits".

Have you tried increasing the Physics Ticks Per Second?

Or could it be friction/drag (linear damping) that counterbalances your velocity increase above certain thresholds?

lost igloo
#

Haven't tried modifying the physics ticks per second. But this is also something that only happens when CCD is on. When it isn't the speed can be quite high.
It resets after collisions.

#

There's no friction or drag.
Increasing physics ticks did change how fast it could go.

I'd be surprised if there really was some kind of speed limit being enforced but there's some kind of strange interaction going on I don't understand. It probably wasn't a good title in hindsight.

I could come up with some kind of hacky workaround, but at this point it's more that I want to know what's going on.

halcyon yarrow
#

Did you zero out the small default friction and drag in the project settings?

lost igloo
#

I hadn't. So I tried that. Didn't seem to help.

cobalt wing
lost igloo
#

So I tried this

func _on_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
    if(linear_velocity.length() < max_vector_magnitude):
        call_deferred("apply_impulse", linear_velocity*0.1)    

This had the same results.

cobalt wing
#

You could add a print statement to this function to check if for some reason with CCD enabled it will trigger multiple times per bounce when the capping happens

lost igloo