It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, all. I'm currently working on a project which involves a number of "Ship" objects which all share a large number of behaviors with one another. Each ship has four associated spawners (guns) which spawn different projectiles in similar, but not identical ways from ship to ship. I've encountered some odd behavior when trying to implement the latest projectile, however, and was hoping for a little elucidation on the matter.
Most of the projectiles spawned by the ships' spawners are to be completely detached from their respective spawners upon spawning, but one in particular is meant to be parented by its spawner, and move along with it (this behavior might seem a little odd, but I'm wishing to implement it this way so as to leverage the base Ship class' behaviors for all of its descendents). Unfortunately, when parenting the spawned projectile to its spawner, the projectile doesn't move along with it at a 1:1 ratio, but rather follows it incredibly slowly, in effect not being attached to its parent in any meaningful way at all. I've found that the forum threads, Creating a Laser and UseSelfAsParent Makes Spawner Move Twice as Fast seem to address the same problem, and removing the projectile's Body attribute does "resolve" the issue, but the fact remains that this projectile must have a Body in order to collide with its necessary colliders. I attempted to circumvent the issue by following the Passing Items from one Object to Another tutorial, and explicitly setting the parent of spawned objects, but this results in the same behavior.
Is there some trick to parenting objects with Body attributes that I'm unaware of, or do I really need to dispense with my universal spawner behavior and incorporate these projectiles as body parts of their associated ships? Thanks in advance.