I have an Area2D class in GDNative which connects to the signal "body_entered" when a bullet enters it.
I really, really don't know why, but this is what I have in the Area2D script, inside the function which is supposed to react to the signal:
Bullet* bullet = (Bullet*) body; //this makes the game crash and returns wrong property values when accessing bullet functions
Bullet* bullet = Object::cast_to< Bullet>(body); //this makes everything work fine, both property access and function usage, without crash
Could someone explain me why?
I wonder which syntax to use depending on the situation.