#new to 3d physics. How do i detect a collision

1 messages · Page 1 of 1 (latest)

toxic tundra
#

So, I have an asteroid and that looks like this
The reason why the script is not on the rigidbody istead but instead on a node above is because that makes it 100 times easier to import new types of astroid models. In any case it should not have effect on the final thing

I want the asteroids to bounce of each other when they hit.
I tried this with a lot of different ways. 1 i made a pyhisics material, and put the bounch on 100, even 10000 and applied that material to the rigid body. nothing happend..

I tried subscribing to the body_entered signal and then when it hits, i apply some force perpendicular to the hit

asteroid.body_entered.connect(_on_asteroid_body_entered)
    
func _on_asteroid_body_entered(body: Node3D):
    var push_direction : Vector3 = (asteroid.global_position - body.global_position).normalized()
    var push_strength : float = 50.0
    asteroid.apply_central_impulse(push_direction * push_strength)
    
    print("Applied extra bounce force!")```
Bit this signal never even got invoked

So i am kinda lost now
#

for more info, here is the entire script and the collision shape