Hello, I was trying to connect the signal "body_entered" to a function in the same struct but i can't do that because i get the following error:
the trait bound `&mut SpeedArea: AsArg<gdnative::prelude::Object>` is not satisfied
the trait `AsArg<gdnative::prelude::Object>` is not implemented for `&mut SpeedArea`
This is my code:
use gdnative::{prelude::*, api::Area2D, api::PhysicsBody2D};
#[derive(NativeClass)]
#[inherit(Area2D)]
pub struct SpeedArea {}
#[methods]
impl SpeedArea {
pub fn new(_owner: &Area2D) -> Self {
Self {}
}
#[export]
fn _ready(&mut self, owner: &Area2D) {
owner.connect("body_entered", owner, "destroy_node", VariantArray::new_shared(), 0).unwrap();
}
#[export]
fn destroy_node(&mut self, owner: &Area2D, body: Ref<PhysicsBody2D>) {
}
}