0 votes

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};

pub struct SpeedArea {}

impl SpeedArea {
    pub fn new(_owner: &Area2D) -> Self {
        Self {}

    fn _ready(&mut self, owner: &Area2D) {
        owner.connect("body_entered", owner, "destroy_node", VariantArray::new_shared(), 0).unwrap();

    fn destroy_node(&mut self, owner: &Area2D, body: Ref<PhysicsBody2D>) {

Godot version 3.4
in Engine by (32 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.