Hello,
im trying to convert some code from GD script to C# but if i try to run it in the C# version its says InvalidCastException.
Heres the code in Gd script: (not the whole file)
var collision = get_slide_collision(index)
if collision.collider.is_in_group("bodies"):
collision.collider.apply_central_impulse(-collision.normal * inertia)```
and heres the c# one: (i dont know how to convert the node to its actual type[i want a rigidbody2d] so i can acess the ApplyCentralImpulse function):
``` for(int index = 0;index<GetSlideCount();index++){
Node collider = (Node)GetSlideCollision(index).Collider;
if(collider.IsInGroup("bodies")){
RigidBody2D rigid = (RigidBody2D) collider;
rigid.ApplyCentralImpulse(GetSlideCollision(index).Normal * inertia);
}
}```