After all the missiles on the aircraft were launched, they were not reconfigured in subsequent environmental resets. We tried to add the following codes to the fit_missile function in MissileDevice Class and the reset function in Aircraft Class but it was still unsuccessful. Print and display all as None.
def fit_missile(self, missile, slot_id):
nd = missile.get_parent_node()
nd.GetTransform().SetParent(self.slots_nodes[slot_id])
# print("Fit Missile"+str(slot_id)+" "+str(pos.x)+" "+str(pos.y)+" "+str(pos.z))
missile.reset(hg.Vec3(0, 0, 0), hg.Vec3(0, 0, 0))
self.missiles[slot_id] = missile
self.missiles_total.append(missile) %%%%%%we add global missiles to reconfigure them when all missiles are fired.
def reset():
%%%%%%we add%%%%%%%%%%%%
md=self.get_device("MissilesDevice")
n_m=md.num_slots
for i in range(n_m):
mmd=md.missiles_total[i]
nmd=md.missiles[i]
if nmd is None:
md.missiles[i] = mmd# reset in there
if position is not None:
nmd.reset(position, rotation)
else:
nmd.reset(hg.Vec3(0, 0, 0), hg.Vec3(0, 0, 0))
After all the missiles on the aircraft were launched, they were not reconfigured in subsequent environmental resets. We tried to add the following codes to the fit_missile function in MissileDevice Class and the reset function in Aircraft Class but it was still unsuccessful. Print and display all as None.
def reset(): %%%%%%we add%%%%%%%%%%%% md=self.get_device("MissilesDevice") n_m=md.num_slots for i in range(n_m): mmd=md.missiles_total[i] nmd=md.missiles[i] if nmd is None: md.missiles[i] = mmd# reset in there